@versini/auth0-react-thin 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/auth-state.d.ts +15 -0
- package/dist/auth-state.d.ts.map +1 -0
- package/dist/auth0-context.d.ts +423 -0
- package/dist/auth0-context.d.ts.map +1 -0
- package/dist/auth0-provider.d.ts +96 -0
- package/dist/auth0-provider.d.ts.map +1 -0
- package/dist/auth0-react.cjs.js +830 -0
- package/dist/auth0-react.cjs.js.map +1 -0
- package/dist/auth0-react.esm.js +723 -0
- package/dist/auth0-react.esm.js.map +1 -0
- package/dist/auth0-react.js +759 -0
- package/dist/auth0-react.js.map +1 -0
- package/dist/auth0-react.min.js +2 -0
- package/dist/auth0-react.min.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/reducer.d.ts +19 -0
- package/dist/reducer.d.ts.map +1 -0
- package/dist/use-auth0.d.ts +29 -0
- package/dist/use-auth0.d.ts.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/with-auth0.d.ts +29 -0
- package/dist/with-auth0.d.ts.map +1 -0
- package/dist/with-authentication-required.d.ts +77 -0
- package/dist/with-authentication-required.d.ts.map +1 -0
- package/package.json +43 -0
- package/src/auth-state.tsx +21 -0
- package/src/auth0-context.tsx +506 -0
- package/src/auth0-provider.tsx +488 -0
- package/src/errors.tsx +14 -0
- package/src/index.tsx +100 -0
- package/src/reducer.tsx +59 -0
- package/src/use-auth0.tsx +34 -0
- package/src/utils.tsx +74 -0
- package/src/with-auth0.tsx +44 -0
- package/src/with-authentication-required.tsx +141 -0
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var auth0SpaJs = require('@auth0/auth0-spa-js');
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
Copyright (c) Microsoft Corporation.
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
+
purpose with or without fee is hereby granted.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
+
***************************************************************************** */
|
|
20
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
21
|
+
|
|
22
|
+
var extendStatics = function(d, b) {
|
|
23
|
+
extendStatics = Object.setPrototypeOf ||
|
|
24
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
25
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
26
|
+
return extendStatics(d, b);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function __extends(d, b) {
|
|
30
|
+
if (typeof b !== "function" && b !== null)
|
|
31
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
32
|
+
extendStatics(d, b);
|
|
33
|
+
function __() { this.constructor = d; }
|
|
34
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var __assign = function() {
|
|
38
|
+
__assign = Object.assign || function __assign(t) {
|
|
39
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
40
|
+
s = arguments[i];
|
|
41
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
};
|
|
45
|
+
return __assign.apply(this, arguments);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function __rest(s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
61
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
62
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
63
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
64
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
65
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
66
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function __generator(thisArg, body) {
|
|
71
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
73
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
74
|
+
function step(op) {
|
|
75
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
76
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
77
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
78
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
79
|
+
switch (op[0]) {
|
|
80
|
+
case 0: case 1: t = op; break;
|
|
81
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
82
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
83
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
84
|
+
default:
|
|
85
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
86
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
87
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
88
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
89
|
+
if (t[2]) _.ops.pop();
|
|
90
|
+
_.trys.pop(); continue;
|
|
91
|
+
}
|
|
92
|
+
op = body.call(thisArg, _);
|
|
93
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
94
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function __spreadArray(to, from, pack) {
|
|
99
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
100
|
+
if (ar || !(i in from)) {
|
|
101
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
102
|
+
ar[i] = from[i];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
109
|
+
var e = new Error(message);
|
|
110
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The initial auth state.
|
|
115
|
+
*/
|
|
116
|
+
var initialAuthState = {
|
|
117
|
+
isAuthenticated: false,
|
|
118
|
+
isLoading: true,
|
|
119
|
+
error: undefined,
|
|
120
|
+
user: undefined,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @ignore
|
|
125
|
+
*/
|
|
126
|
+
var stub = function () {
|
|
127
|
+
throw new Error('You forgot to wrap your component in <Auth0Provider>.');
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* @ignore
|
|
131
|
+
*/
|
|
132
|
+
var initialContext = __assign(__assign({}, initialAuthState), { buildAuthorizeUrl: stub, buildLogoutUrl: stub, getAccessTokenSilently: stub, getAccessTokenWithPopup: stub, getIdTokenClaims: stub, loginWithCustomTokenExchange: stub, customTokenExchange: stub, exchangeToken: stub, loginWithRedirect: stub, loginWithPopup: stub, connectAccountWithRedirect: stub, logout: stub, handleRedirectCallback: stub, getDpopNonce: stub, setDpopNonce: stub, generateDpopProof: stub, createFetcher: stub, getConfiguration: stub, mfa: {
|
|
133
|
+
getAuthenticators: stub,
|
|
134
|
+
enroll: stub,
|
|
135
|
+
challenge: stub,
|
|
136
|
+
verify: stub,
|
|
137
|
+
getEnrollmentFactors: stub,
|
|
138
|
+
}, passkey: {
|
|
139
|
+
signup: stub,
|
|
140
|
+
login: stub,
|
|
141
|
+
}, myAccount: {
|
|
142
|
+
getFactors: stub,
|
|
143
|
+
getAuthenticationMethods: stub,
|
|
144
|
+
getAuthenticationMethod: stub,
|
|
145
|
+
updateAuthenticationMethod: stub,
|
|
146
|
+
deleteAuthenticationMethod: stub,
|
|
147
|
+
enrollmentChallenge: stub,
|
|
148
|
+
enrollmentVerify: stub,
|
|
149
|
+
} });
|
|
150
|
+
/**
|
|
151
|
+
* The Auth0 Context
|
|
152
|
+
*/
|
|
153
|
+
var Auth0Context = React.createContext(initialContext);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* An OAuth2 error will come from the authorization server and will have at least an `error` property which will
|
|
157
|
+
* be the error code. And possibly an `error_description` property
|
|
158
|
+
*
|
|
159
|
+
* See: https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.6
|
|
160
|
+
*/
|
|
161
|
+
var OAuthError = /** @class */ (function (_super) {
|
|
162
|
+
__extends(OAuthError, _super);
|
|
163
|
+
function OAuthError(error, error_description) {
|
|
164
|
+
var _this = _super.call(this, error_description !== null && error_description !== void 0 ? error_description : error) || this;
|
|
165
|
+
_this.error = error;
|
|
166
|
+
_this.error_description = error_description;
|
|
167
|
+
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
168
|
+
Object.setPrototypeOf(_this, OAuthError.prototype);
|
|
169
|
+
return _this;
|
|
170
|
+
}
|
|
171
|
+
return OAuthError;
|
|
172
|
+
}(Error));
|
|
173
|
+
|
|
174
|
+
var CODE_RE = /[?&](?:connect_)?code=[^&]+/;
|
|
175
|
+
var STATE_RE = /[?&]state=[^&]+/;
|
|
176
|
+
var ERROR_RE = /[?&]error=[^&]+/;
|
|
177
|
+
var hasAuthParams = function (searchParams) {
|
|
178
|
+
if (searchParams === void 0) { searchParams = window.location.search; }
|
|
179
|
+
return (CODE_RE.test(searchParams) || ERROR_RE.test(searchParams)) &&
|
|
180
|
+
STATE_RE.test(searchParams);
|
|
181
|
+
};
|
|
182
|
+
var normalizeErrorFn = function (fallbackMessage) {
|
|
183
|
+
return function (error) {
|
|
184
|
+
if (error instanceof Error) {
|
|
185
|
+
return error;
|
|
186
|
+
}
|
|
187
|
+
// try to check errors of the following form: {error: string; error_description?: string}
|
|
188
|
+
if (error !== null &&
|
|
189
|
+
typeof error === 'object' &&
|
|
190
|
+
'error' in error &&
|
|
191
|
+
typeof error.error === 'string') {
|
|
192
|
+
if ('error_description' in error &&
|
|
193
|
+
typeof error.error_description === 'string') {
|
|
194
|
+
var e_1 = error;
|
|
195
|
+
return new OAuthError(e_1.error, e_1.error_description);
|
|
196
|
+
}
|
|
197
|
+
var e = error;
|
|
198
|
+
return new OAuthError(e.error);
|
|
199
|
+
}
|
|
200
|
+
return new Error(fallbackMessage);
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
var loginError = normalizeErrorFn('Login failed');
|
|
204
|
+
var tokenError = normalizeErrorFn('Get access token failed');
|
|
205
|
+
/**
|
|
206
|
+
* @ignore
|
|
207
|
+
* Helper function to map the v1 `redirectUri` option to the v2 `authorizationParams.redirect_uri`
|
|
208
|
+
* and log a warning.
|
|
209
|
+
*/
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
211
|
+
var deprecateRedirectUri = function (options) {
|
|
212
|
+
var _a, _b;
|
|
213
|
+
if (options === null || options === void 0 ? void 0 : options.redirectUri) {
|
|
214
|
+
console.warn('Using `redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version');
|
|
215
|
+
options.authorizationParams = (_a = options.authorizationParams) !== null && _a !== void 0 ? _a : {};
|
|
216
|
+
options.authorizationParams.redirect_uri = options.redirectUri;
|
|
217
|
+
delete options.redirectUri;
|
|
218
|
+
}
|
|
219
|
+
if ((_b = options === null || options === void 0 ? void 0 : options.authorizationParams) === null || _b === void 0 ? void 0 : _b.redirectUri) {
|
|
220
|
+
console.warn('Using `authorizationParams.redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version');
|
|
221
|
+
options.authorizationParams.redirect_uri =
|
|
222
|
+
options.authorizationParams.redirectUri;
|
|
223
|
+
delete options.authorizationParams.redirectUri;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Handles how that state changes in the `useAuth0` hook.
|
|
229
|
+
*/
|
|
230
|
+
var reducer = function (state, action) {
|
|
231
|
+
switch (action.type) {
|
|
232
|
+
case 'LOGIN_POPUP_STARTED':
|
|
233
|
+
return __assign(__assign({}, state), { isLoading: true });
|
|
234
|
+
case 'LOGIN_POPUP_COMPLETE':
|
|
235
|
+
case 'INITIALISED':
|
|
236
|
+
return __assign(__assign({}, state), { isAuthenticated: !!action.user, user: action.user, isLoading: false, error: undefined });
|
|
237
|
+
case 'HANDLE_REDIRECT_COMPLETE':
|
|
238
|
+
case 'GET_ACCESS_TOKEN_COMPLETE':
|
|
239
|
+
if (state.user === action.user) {
|
|
240
|
+
return state;
|
|
241
|
+
}
|
|
242
|
+
return __assign(__assign({}, state), { isAuthenticated: !!action.user, user: action.user });
|
|
243
|
+
case 'LOGOUT':
|
|
244
|
+
return __assign(__assign({}, state), { isAuthenticated: false, user: undefined });
|
|
245
|
+
case 'ERROR':
|
|
246
|
+
return __assign(__assign({}, state), { isLoading: false, error: action.error });
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @ignore
|
|
252
|
+
*/
|
|
253
|
+
var toAuth0ClientOptions = function (opts) {
|
|
254
|
+
deprecateRedirectUri(opts);
|
|
255
|
+
return __assign(__assign({}, opts), { auth0Client: {
|
|
256
|
+
name: 'auth0-react',
|
|
257
|
+
version: '2.19.0',
|
|
258
|
+
} });
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* @ignore
|
|
262
|
+
*/
|
|
263
|
+
var defaultOnRedirectCallback = function (appState) {
|
|
264
|
+
var _a;
|
|
265
|
+
window.history.replaceState({}, document.title, (_a = appState.returnTo) !== null && _a !== void 0 ? _a : window.location.pathname);
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* ```jsx
|
|
269
|
+
* <Auth0Provider
|
|
270
|
+
* domain={domain}
|
|
271
|
+
* clientId={clientId}
|
|
272
|
+
* authorizationParams={{ redirect_uri: window.location.origin }}>
|
|
273
|
+
* <MyApp />
|
|
274
|
+
* </Auth0Provider>
|
|
275
|
+
* ```
|
|
276
|
+
*
|
|
277
|
+
* Provides the Auth0Context to its child components.
|
|
278
|
+
*/
|
|
279
|
+
var Auth0Provider = function (opts) {
|
|
280
|
+
var _a = opts, children = _a.children, skipRedirectCallback = _a.skipRedirectCallback, _b = _a.onRedirectCallback, onRedirectCallback = _b === void 0 ? defaultOnRedirectCallback : _b, _c = _a.context, context = _c === void 0 ? Auth0Context : _c, providedClient = _a.client, clientOpts = __rest(_a, ["children", "skipRedirectCallback", "onRedirectCallback", "context", "client"]);
|
|
281
|
+
if (providedClient && (clientOpts.domain || clientOpts.clientId)) {
|
|
282
|
+
console.warn('Auth0Provider: the `client` prop takes precedence over `domain`/`clientId` and other ' +
|
|
283
|
+
'configuration options. Remove `domain`, `clientId`, and any other Auth0Client configuration ' +
|
|
284
|
+
'props when using the `client` prop.');
|
|
285
|
+
}
|
|
286
|
+
var client = React.useState(function () { return providedClient !== null && providedClient !== void 0 ? providedClient : new auth0SpaJs.Auth0Client(toAuth0ClientOptions(clientOpts)); })[0];
|
|
287
|
+
var _d = React.useReducer((reducer), initialAuthState), state = _d[0], dispatch = _d[1];
|
|
288
|
+
var didInitialise = React.useRef(false);
|
|
289
|
+
var handleError = React.useCallback(function (error) {
|
|
290
|
+
dispatch({ type: 'ERROR', error: error });
|
|
291
|
+
return error;
|
|
292
|
+
}, []);
|
|
293
|
+
React.useEffect(function () {
|
|
294
|
+
if (didInitialise.current) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
didInitialise.current = true;
|
|
298
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
+
var user, _a, _b, appState, response_type, result, error_1;
|
|
300
|
+
return __generator(this, function (_c) {
|
|
301
|
+
switch (_c.label) {
|
|
302
|
+
case 0:
|
|
303
|
+
_c.trys.push([0, 7, , 8]);
|
|
304
|
+
user = void 0;
|
|
305
|
+
if (!(hasAuthParams() && !skipRedirectCallback)) return [3 /*break*/, 3];
|
|
306
|
+
return [4 /*yield*/, client.handleRedirectCallback()];
|
|
307
|
+
case 1:
|
|
308
|
+
_a = _c.sent(), _b = _a.appState, appState = _b === void 0 ? {} : _b, response_type = _a.response_type, result = __rest(_a, ["appState", "response_type"]);
|
|
309
|
+
return [4 /*yield*/, client.getUser()];
|
|
310
|
+
case 2:
|
|
311
|
+
user = _c.sent();
|
|
312
|
+
appState.response_type = response_type;
|
|
313
|
+
if (response_type === auth0SpaJs.ResponseType.ConnectCode) {
|
|
314
|
+
appState.connectedAccount = result;
|
|
315
|
+
}
|
|
316
|
+
onRedirectCallback(appState, user);
|
|
317
|
+
return [3 /*break*/, 6];
|
|
318
|
+
case 3: return [4 /*yield*/, client.checkSession()];
|
|
319
|
+
case 4:
|
|
320
|
+
_c.sent();
|
|
321
|
+
return [4 /*yield*/, client.getUser()];
|
|
322
|
+
case 5:
|
|
323
|
+
user = _c.sent();
|
|
324
|
+
_c.label = 6;
|
|
325
|
+
case 6:
|
|
326
|
+
dispatch({ type: 'INITIALISED', user: user });
|
|
327
|
+
return [3 /*break*/, 8];
|
|
328
|
+
case 7:
|
|
329
|
+
error_1 = _c.sent();
|
|
330
|
+
handleError(loginError(error_1));
|
|
331
|
+
return [3 /*break*/, 8];
|
|
332
|
+
case 8: return [2 /*return*/];
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}); })();
|
|
336
|
+
}, [client, onRedirectCallback, skipRedirectCallback, handleError]);
|
|
337
|
+
var loginWithRedirect = React.useCallback(function (opts) {
|
|
338
|
+
deprecateRedirectUri(opts);
|
|
339
|
+
return client.loginWithRedirect(opts);
|
|
340
|
+
}, [client]);
|
|
341
|
+
var loginWithPopup = React.useCallback(function (options, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
342
|
+
var error_2, user;
|
|
343
|
+
return __generator(this, function (_a) {
|
|
344
|
+
switch (_a.label) {
|
|
345
|
+
case 0:
|
|
346
|
+
dispatch({ type: 'LOGIN_POPUP_STARTED' });
|
|
347
|
+
_a.label = 1;
|
|
348
|
+
case 1:
|
|
349
|
+
_a.trys.push([1, 3, , 4]);
|
|
350
|
+
return [4 /*yield*/, client.loginWithPopup(options, config)];
|
|
351
|
+
case 2:
|
|
352
|
+
_a.sent();
|
|
353
|
+
return [3 /*break*/, 4];
|
|
354
|
+
case 3:
|
|
355
|
+
error_2 = _a.sent();
|
|
356
|
+
handleError(loginError(error_2));
|
|
357
|
+
return [2 /*return*/];
|
|
358
|
+
case 4: return [4 /*yield*/, client.getUser()];
|
|
359
|
+
case 5:
|
|
360
|
+
user = _a.sent();
|
|
361
|
+
dispatch({ type: 'LOGIN_POPUP_COMPLETE', user: user });
|
|
362
|
+
return [2 /*return*/];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}); }, [client, handleError]);
|
|
366
|
+
var logout = React.useCallback(function () {
|
|
367
|
+
var args_1 = [];
|
|
368
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
369
|
+
args_1[_i] = arguments[_i];
|
|
370
|
+
}
|
|
371
|
+
return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (opts) {
|
|
372
|
+
if (opts === void 0) { opts = {}; }
|
|
373
|
+
return __generator(this, function (_a) {
|
|
374
|
+
switch (_a.label) {
|
|
375
|
+
case 0: return [4 /*yield*/, client.logout(opts)];
|
|
376
|
+
case 1:
|
|
377
|
+
_a.sent();
|
|
378
|
+
if (opts.openUrl || opts.openUrl === false) {
|
|
379
|
+
dispatch({ type: 'LOGOUT' });
|
|
380
|
+
}
|
|
381
|
+
return [2 /*return*/];
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
}, [client]);
|
|
386
|
+
var getAccessTokenSilently = React.useCallback(
|
|
387
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
388
|
+
function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
389
|
+
var token, error_3, _a;
|
|
390
|
+
var _b;
|
|
391
|
+
return __generator(this, function (_c) {
|
|
392
|
+
switch (_c.label) {
|
|
393
|
+
case 0:
|
|
394
|
+
_c.trys.push([0, 2, 3, 5]);
|
|
395
|
+
return [4 /*yield*/, client.getTokenSilently(opts)];
|
|
396
|
+
case 1:
|
|
397
|
+
token = _c.sent();
|
|
398
|
+
return [3 /*break*/, 5];
|
|
399
|
+
case 2:
|
|
400
|
+
error_3 = _c.sent();
|
|
401
|
+
throw tokenError(error_3);
|
|
402
|
+
case 3:
|
|
403
|
+
_a = dispatch;
|
|
404
|
+
_b = {
|
|
405
|
+
type: 'GET_ACCESS_TOKEN_COMPLETE'
|
|
406
|
+
};
|
|
407
|
+
return [4 /*yield*/, client.getUser()];
|
|
408
|
+
case 4:
|
|
409
|
+
_a.apply(void 0, [(_b.user = _c.sent(),
|
|
410
|
+
_b)]);
|
|
411
|
+
return [7 /*endfinally*/];
|
|
412
|
+
case 5: return [2 /*return*/, token];
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}); }, [client]);
|
|
416
|
+
var getAccessTokenWithPopup = React.useCallback(function (opts, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
417
|
+
var token, error_4, _a;
|
|
418
|
+
var _b;
|
|
419
|
+
return __generator(this, function (_c) {
|
|
420
|
+
switch (_c.label) {
|
|
421
|
+
case 0:
|
|
422
|
+
_c.trys.push([0, 2, 3, 5]);
|
|
423
|
+
return [4 /*yield*/, client.getTokenWithPopup(opts, config)];
|
|
424
|
+
case 1:
|
|
425
|
+
token = _c.sent();
|
|
426
|
+
return [3 /*break*/, 5];
|
|
427
|
+
case 2:
|
|
428
|
+
error_4 = _c.sent();
|
|
429
|
+
throw tokenError(error_4);
|
|
430
|
+
case 3:
|
|
431
|
+
_a = dispatch;
|
|
432
|
+
_b = {
|
|
433
|
+
type: 'GET_ACCESS_TOKEN_COMPLETE'
|
|
434
|
+
};
|
|
435
|
+
return [4 /*yield*/, client.getUser()];
|
|
436
|
+
case 4:
|
|
437
|
+
_a.apply(void 0, [(_b.user = _c.sent(),
|
|
438
|
+
_b)]);
|
|
439
|
+
return [7 /*endfinally*/];
|
|
440
|
+
case 5: return [2 /*return*/, token];
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}); }, [client]);
|
|
444
|
+
var connectAccountWithRedirect = React.useCallback(function (options) {
|
|
445
|
+
return client.connectAccountWithRedirect(options);
|
|
446
|
+
}, [client]);
|
|
447
|
+
var getIdTokenClaims = React.useCallback(function () { return client.getIdTokenClaims(); }, [client]);
|
|
448
|
+
var loginWithCustomTokenExchange = React.useCallback(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
449
|
+
var tokenResponse, error_5, _a;
|
|
450
|
+
var _b;
|
|
451
|
+
return __generator(this, function (_c) {
|
|
452
|
+
switch (_c.label) {
|
|
453
|
+
case 0:
|
|
454
|
+
_c.trys.push([0, 2, 3, 5]);
|
|
455
|
+
return [4 /*yield*/, client.loginWithCustomTokenExchange(options)];
|
|
456
|
+
case 1:
|
|
457
|
+
tokenResponse = _c.sent();
|
|
458
|
+
return [3 /*break*/, 5];
|
|
459
|
+
case 2:
|
|
460
|
+
error_5 = _c.sent();
|
|
461
|
+
throw tokenError(error_5);
|
|
462
|
+
case 3:
|
|
463
|
+
// We dispatch the standard GET_ACCESS_TOKEN_COMPLETE action here to maintain
|
|
464
|
+
// backward compatibility and consistency with the getAccessTokenSilently flow.
|
|
465
|
+
// This ensures the SDK's internal state lifecycle (loading/user updates) remains
|
|
466
|
+
// identical regardless of whether the token was retrieved via silent auth or CTE.
|
|
467
|
+
_a = dispatch;
|
|
468
|
+
_b = {
|
|
469
|
+
type: 'GET_ACCESS_TOKEN_COMPLETE'
|
|
470
|
+
};
|
|
471
|
+
return [4 /*yield*/, client.getUser()];
|
|
472
|
+
case 4:
|
|
473
|
+
// We dispatch the standard GET_ACCESS_TOKEN_COMPLETE action here to maintain
|
|
474
|
+
// backward compatibility and consistency with the getAccessTokenSilently flow.
|
|
475
|
+
// This ensures the SDK's internal state lifecycle (loading/user updates) remains
|
|
476
|
+
// identical regardless of whether the token was retrieved via silent auth or CTE.
|
|
477
|
+
_a.apply(void 0, [(_b.user = _c.sent(),
|
|
478
|
+
_b)]);
|
|
479
|
+
return [7 /*endfinally*/];
|
|
480
|
+
case 5: return [2 /*return*/, tokenResponse];
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}); }, [client]);
|
|
484
|
+
var customTokenExchange = React.useCallback(function (options) {
|
|
485
|
+
return client.customTokenExchange(options);
|
|
486
|
+
}, [client]);
|
|
487
|
+
var exchangeToken = React.useCallback(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
488
|
+
return __generator(this, function (_a) {
|
|
489
|
+
return [2 /*return*/, loginWithCustomTokenExchange(options)];
|
|
490
|
+
});
|
|
491
|
+
}); }, [loginWithCustomTokenExchange]);
|
|
492
|
+
var handleRedirectCallback = React.useCallback(function (url) { return __awaiter(void 0, void 0, void 0, function () {
|
|
493
|
+
var error_6, _a;
|
|
494
|
+
var _b;
|
|
495
|
+
return __generator(this, function (_c) {
|
|
496
|
+
switch (_c.label) {
|
|
497
|
+
case 0:
|
|
498
|
+
_c.trys.push([0, 2, 3, 5]);
|
|
499
|
+
return [4 /*yield*/, client.handleRedirectCallback(url)];
|
|
500
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
501
|
+
case 2:
|
|
502
|
+
error_6 = _c.sent();
|
|
503
|
+
throw tokenError(error_6);
|
|
504
|
+
case 3:
|
|
505
|
+
_a = dispatch;
|
|
506
|
+
_b = {
|
|
507
|
+
type: 'HANDLE_REDIRECT_COMPLETE'
|
|
508
|
+
};
|
|
509
|
+
return [4 /*yield*/, client.getUser()];
|
|
510
|
+
case 4:
|
|
511
|
+
_a.apply(void 0, [(_b.user = _c.sent(),
|
|
512
|
+
_b)]);
|
|
513
|
+
return [7 /*endfinally*/];
|
|
514
|
+
case 5: return [2 /*return*/];
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
}); }, [client]);
|
|
518
|
+
var getDpopNonce = React.useCallback(function (id) { return client.getDpopNonce(id); }, [client]);
|
|
519
|
+
var setDpopNonce = React.useCallback(function (nonce, id) { return client.setDpopNonce(nonce, id); }, [client]);
|
|
520
|
+
var generateDpopProof = React.useCallback(function (params) { return client.generateDpopProof(params); }, [client]);
|
|
521
|
+
var createFetcher = React.useCallback(function (config) { return client.createFetcher(config); }, [client]);
|
|
522
|
+
var getConfiguration = React.useCallback(function () { return client.getConfiguration(); }, [client]);
|
|
523
|
+
var mfa = React.useMemo(function () { return client.mfa; }, [client]);
|
|
524
|
+
var myAccount = React.useMemo(function () { return client.myAccount; }, [client]);
|
|
525
|
+
var passkeySignup = React.useCallback(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
526
|
+
var tokenResponse, error_7, _a;
|
|
527
|
+
var _b;
|
|
528
|
+
return __generator(this, function (_c) {
|
|
529
|
+
switch (_c.label) {
|
|
530
|
+
case 0:
|
|
531
|
+
_c.trys.push([0, 2, 3, 5]);
|
|
532
|
+
return [4 /*yield*/, client.passkey.signup(options)];
|
|
533
|
+
case 1:
|
|
534
|
+
tokenResponse = _c.sent();
|
|
535
|
+
return [3 /*break*/, 5];
|
|
536
|
+
case 2:
|
|
537
|
+
error_7 = _c.sent();
|
|
538
|
+
throw tokenError(error_7);
|
|
539
|
+
case 3:
|
|
540
|
+
_a = dispatch;
|
|
541
|
+
_b = {
|
|
542
|
+
type: 'GET_ACCESS_TOKEN_COMPLETE'
|
|
543
|
+
};
|
|
544
|
+
return [4 /*yield*/, client.getUser()];
|
|
545
|
+
case 4:
|
|
546
|
+
_a.apply(void 0, [(_b.user = _c.sent(),
|
|
547
|
+
_b)]);
|
|
548
|
+
return [7 /*endfinally*/];
|
|
549
|
+
case 5: return [2 /*return*/, tokenResponse];
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}); }, [client]);
|
|
553
|
+
var passkeyLogin = React.useCallback(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
554
|
+
var tokenResponse, error_8, _a;
|
|
555
|
+
var _b;
|
|
556
|
+
return __generator(this, function (_c) {
|
|
557
|
+
switch (_c.label) {
|
|
558
|
+
case 0:
|
|
559
|
+
_c.trys.push([0, 2, 3, 5]);
|
|
560
|
+
return [4 /*yield*/, client.passkey.login(options)];
|
|
561
|
+
case 1:
|
|
562
|
+
tokenResponse = _c.sent();
|
|
563
|
+
return [3 /*break*/, 5];
|
|
564
|
+
case 2:
|
|
565
|
+
error_8 = _c.sent();
|
|
566
|
+
throw tokenError(error_8);
|
|
567
|
+
case 3:
|
|
568
|
+
_a = dispatch;
|
|
569
|
+
_b = {
|
|
570
|
+
type: 'GET_ACCESS_TOKEN_COMPLETE'
|
|
571
|
+
};
|
|
572
|
+
return [4 /*yield*/, client.getUser()];
|
|
573
|
+
case 4:
|
|
574
|
+
_a.apply(void 0, [(_b.user = _c.sent(),
|
|
575
|
+
_b)]);
|
|
576
|
+
return [7 /*endfinally*/];
|
|
577
|
+
case 5: return [2 /*return*/, tokenResponse];
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}); }, [client]);
|
|
581
|
+
var passkey = React.useMemo(function () { return ({ signup: passkeySignup, login: passkeyLogin }); }, [passkeySignup, passkeyLogin]);
|
|
582
|
+
var contextValue = React.useMemo(function () {
|
|
583
|
+
return __assign(__assign({}, state), { getAccessTokenSilently: getAccessTokenSilently, getAccessTokenWithPopup: getAccessTokenWithPopup, getIdTokenClaims: getIdTokenClaims, loginWithCustomTokenExchange: loginWithCustomTokenExchange, customTokenExchange: customTokenExchange, exchangeToken: exchangeToken, loginWithRedirect: loginWithRedirect, loginWithPopup: loginWithPopup, connectAccountWithRedirect: connectAccountWithRedirect, logout: logout, handleRedirectCallback: handleRedirectCallback, getDpopNonce: getDpopNonce, setDpopNonce: setDpopNonce, generateDpopProof: generateDpopProof, createFetcher: createFetcher, getConfiguration: getConfiguration, mfa: mfa, passkey: passkey, myAccount: myAccount });
|
|
584
|
+
}, [
|
|
585
|
+
state,
|
|
586
|
+
getAccessTokenSilently,
|
|
587
|
+
getAccessTokenWithPopup,
|
|
588
|
+
getIdTokenClaims,
|
|
589
|
+
loginWithCustomTokenExchange,
|
|
590
|
+
customTokenExchange,
|
|
591
|
+
exchangeToken,
|
|
592
|
+
loginWithRedirect,
|
|
593
|
+
loginWithPopup,
|
|
594
|
+
connectAccountWithRedirect,
|
|
595
|
+
logout,
|
|
596
|
+
handleRedirectCallback,
|
|
597
|
+
getDpopNonce,
|
|
598
|
+
setDpopNonce,
|
|
599
|
+
generateDpopProof,
|
|
600
|
+
createFetcher,
|
|
601
|
+
getConfiguration,
|
|
602
|
+
mfa,
|
|
603
|
+
passkey,
|
|
604
|
+
myAccount,
|
|
605
|
+
]);
|
|
606
|
+
return React.createElement(context.Provider, { value: contextValue }, children);
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* ```js
|
|
611
|
+
* const {
|
|
612
|
+
* // Auth state:
|
|
613
|
+
* error,
|
|
614
|
+
* isAuthenticated,
|
|
615
|
+
* isLoading,
|
|
616
|
+
* user,
|
|
617
|
+
* // Auth methods:
|
|
618
|
+
* getAccessTokenSilently,
|
|
619
|
+
* getAccessTokenWithPopup,
|
|
620
|
+
* getIdTokenClaims,
|
|
621
|
+
* loginWithCustomTokenExchange,
|
|
622
|
+
* exchangeToken, // deprecated - use loginWithCustomTokenExchange
|
|
623
|
+
* loginWithRedirect,
|
|
624
|
+
* loginWithPopup,
|
|
625
|
+
* logout,
|
|
626
|
+
* } = useAuth0<TUser>();
|
|
627
|
+
* ```
|
|
628
|
+
*
|
|
629
|
+
* Use the `useAuth0` hook in your components to access the auth state and methods.
|
|
630
|
+
*
|
|
631
|
+
* TUser is an optional type param to provide a type to the `user` field.
|
|
632
|
+
*/
|
|
633
|
+
var useAuth0 = function (context) {
|
|
634
|
+
if (context === void 0) { context = Auth0Context; }
|
|
635
|
+
return React.useContext(context);
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* ```jsx
|
|
640
|
+
* class MyComponent extends Component {
|
|
641
|
+
* render() {
|
|
642
|
+
* // Access the auth context from the `auth0` prop
|
|
643
|
+
* const { user } = this.props.auth0;
|
|
644
|
+
* return <div>Hello {user.name}!</div>
|
|
645
|
+
* }
|
|
646
|
+
* }
|
|
647
|
+
* // Wrap your class component in withAuth0
|
|
648
|
+
* export default withAuth0(MyComponent);
|
|
649
|
+
* ```
|
|
650
|
+
*
|
|
651
|
+
* Wrap your class components in this Higher Order Component to give them access to the Auth0Context.
|
|
652
|
+
*
|
|
653
|
+
* Providing a context as the second argument allows you to configure the Auth0Provider the Auth0Context
|
|
654
|
+
* should come from f you have multiple within your application.
|
|
655
|
+
*/
|
|
656
|
+
var withAuth0 = function (Component, context) {
|
|
657
|
+
if (context === void 0) { context = Auth0Context; }
|
|
658
|
+
return function WithAuth(props) {
|
|
659
|
+
return (React.createElement(context.Consumer, null, function (auth) { return (React.createElement(Component, __assign({}, props, { auth0: auth }))); }));
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* @ignore
|
|
665
|
+
*/
|
|
666
|
+
var defaultOnRedirecting = function () { return React.createElement(React.Fragment, null); };
|
|
667
|
+
/**
|
|
668
|
+
* @ignore
|
|
669
|
+
*/
|
|
670
|
+
var defaultOnBeforeAuthentication = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
671
|
+
return [2 /*return*/];
|
|
672
|
+
}); }); };
|
|
673
|
+
/**
|
|
674
|
+
* @ignore
|
|
675
|
+
*/
|
|
676
|
+
var defaultReturnTo = function () {
|
|
677
|
+
return "".concat(window.location.pathname).concat(window.location.search);
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* ```js
|
|
681
|
+
* const MyProtectedComponent = withAuthenticationRequired(MyComponent);
|
|
682
|
+
* ```
|
|
683
|
+
*
|
|
684
|
+
* When you wrap your components in this Higher Order Component and an anonymous user visits your component
|
|
685
|
+
* they will be redirected to the login page; after login they will be returned to the page they were redirected from.
|
|
686
|
+
*/
|
|
687
|
+
var withAuthenticationRequired = function (Component, options) {
|
|
688
|
+
if (options === void 0) { options = {}; }
|
|
689
|
+
return function WithAuthenticationRequired(props) {
|
|
690
|
+
var _this = this;
|
|
691
|
+
var _a = options.returnTo, returnTo = _a === void 0 ? defaultReturnTo : _a, _b = options.onRedirecting, onRedirecting = _b === void 0 ? defaultOnRedirecting : _b, _c = options.onBeforeAuthentication, onBeforeAuthentication = _c === void 0 ? defaultOnBeforeAuthentication : _c, loginOptions = options.loginOptions, _d = options.context, context = _d === void 0 ? Auth0Context : _d;
|
|
692
|
+
var _e = useAuth0(context), isAuthenticated = _e.isAuthenticated, isLoading = _e.isLoading, loginWithRedirect = _e.loginWithRedirect;
|
|
693
|
+
React.useEffect(function () {
|
|
694
|
+
if (isLoading || isAuthenticated) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
var opts = __assign(__assign({}, loginOptions), { appState: __assign(__assign({}, loginOptions === null || loginOptions === void 0 ? void 0 : loginOptions.appState), { returnTo: typeof returnTo === 'function' ? returnTo() : returnTo }) });
|
|
698
|
+
void (function () { return __awaiter(_this, void 0, void 0, function () {
|
|
699
|
+
return __generator(this, function (_a) {
|
|
700
|
+
switch (_a.label) {
|
|
701
|
+
case 0: return [4 /*yield*/, onBeforeAuthentication()];
|
|
702
|
+
case 1:
|
|
703
|
+
_a.sent();
|
|
704
|
+
return [4 /*yield*/, loginWithRedirect(opts)];
|
|
705
|
+
case 2:
|
|
706
|
+
_a.sent();
|
|
707
|
+
return [2 /*return*/];
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
}); })();
|
|
711
|
+
}, [
|
|
712
|
+
isLoading,
|
|
713
|
+
isAuthenticated,
|
|
714
|
+
loginWithRedirect,
|
|
715
|
+
onBeforeAuthentication,
|
|
716
|
+
loginOptions,
|
|
717
|
+
returnTo,
|
|
718
|
+
]);
|
|
719
|
+
return isAuthenticated ? React.createElement(Component, __assign({}, props)) : onRedirecting();
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
Object.defineProperty(exports, 'AuthenticationError', {
|
|
724
|
+
enumerable: true,
|
|
725
|
+
get: function () { return auth0SpaJs.AuthenticationError; }
|
|
726
|
+
});
|
|
727
|
+
Object.defineProperty(exports, 'ConnectError', {
|
|
728
|
+
enumerable: true,
|
|
729
|
+
get: function () { return auth0SpaJs.ConnectError; }
|
|
730
|
+
});
|
|
731
|
+
Object.defineProperty(exports, 'GenericError', {
|
|
732
|
+
enumerable: true,
|
|
733
|
+
get: function () { return auth0SpaJs.GenericError; }
|
|
734
|
+
});
|
|
735
|
+
Object.defineProperty(exports, 'InMemoryCache', {
|
|
736
|
+
enumerable: true,
|
|
737
|
+
get: function () { return auth0SpaJs.InMemoryCache; }
|
|
738
|
+
});
|
|
739
|
+
Object.defineProperty(exports, 'LocalStorageCache', {
|
|
740
|
+
enumerable: true,
|
|
741
|
+
get: function () { return auth0SpaJs.LocalStorageCache; }
|
|
742
|
+
});
|
|
743
|
+
Object.defineProperty(exports, 'MfaChallengeError', {
|
|
744
|
+
enumerable: true,
|
|
745
|
+
get: function () { return auth0SpaJs.MfaChallengeError; }
|
|
746
|
+
});
|
|
747
|
+
Object.defineProperty(exports, 'MfaEnrollmentError', {
|
|
748
|
+
enumerable: true,
|
|
749
|
+
get: function () { return auth0SpaJs.MfaEnrollmentError; }
|
|
750
|
+
});
|
|
751
|
+
Object.defineProperty(exports, 'MfaEnrollmentFactorsError', {
|
|
752
|
+
enumerable: true,
|
|
753
|
+
get: function () { return auth0SpaJs.MfaEnrollmentFactorsError; }
|
|
754
|
+
});
|
|
755
|
+
Object.defineProperty(exports, 'MfaError', {
|
|
756
|
+
enumerable: true,
|
|
757
|
+
get: function () { return auth0SpaJs.MfaError; }
|
|
758
|
+
});
|
|
759
|
+
Object.defineProperty(exports, 'MfaListAuthenticatorsError', {
|
|
760
|
+
enumerable: true,
|
|
761
|
+
get: function () { return auth0SpaJs.MfaListAuthenticatorsError; }
|
|
762
|
+
});
|
|
763
|
+
Object.defineProperty(exports, 'MfaRequiredError', {
|
|
764
|
+
enumerable: true,
|
|
765
|
+
get: function () { return auth0SpaJs.MfaRequiredError; }
|
|
766
|
+
});
|
|
767
|
+
Object.defineProperty(exports, 'MfaVerifyError', {
|
|
768
|
+
enumerable: true,
|
|
769
|
+
get: function () { return auth0SpaJs.MfaVerifyError; }
|
|
770
|
+
});
|
|
771
|
+
Object.defineProperty(exports, 'MissingRefreshTokenError', {
|
|
772
|
+
enumerable: true,
|
|
773
|
+
get: function () { return auth0SpaJs.MissingRefreshTokenError; }
|
|
774
|
+
});
|
|
775
|
+
Object.defineProperty(exports, 'MyAccountApiError', {
|
|
776
|
+
enumerable: true,
|
|
777
|
+
get: function () { return auth0SpaJs.MyAccountApiError; }
|
|
778
|
+
});
|
|
779
|
+
Object.defineProperty(exports, 'PasskeyChallengeError', {
|
|
780
|
+
enumerable: true,
|
|
781
|
+
get: function () { return auth0SpaJs.PasskeyChallengeError; }
|
|
782
|
+
});
|
|
783
|
+
Object.defineProperty(exports, 'PasskeyError', {
|
|
784
|
+
enumerable: true,
|
|
785
|
+
get: function () { return auth0SpaJs.PasskeyError; }
|
|
786
|
+
});
|
|
787
|
+
Object.defineProperty(exports, 'PasskeyGetTokenError', {
|
|
788
|
+
enumerable: true,
|
|
789
|
+
get: function () { return auth0SpaJs.PasskeyGetTokenError; }
|
|
790
|
+
});
|
|
791
|
+
Object.defineProperty(exports, 'PasskeyRegisterError', {
|
|
792
|
+
enumerable: true,
|
|
793
|
+
get: function () { return auth0SpaJs.PasskeyRegisterError; }
|
|
794
|
+
});
|
|
795
|
+
Object.defineProperty(exports, 'PopupCancelledError', {
|
|
796
|
+
enumerable: true,
|
|
797
|
+
get: function () { return auth0SpaJs.PopupCancelledError; }
|
|
798
|
+
});
|
|
799
|
+
Object.defineProperty(exports, 'PopupOpenError', {
|
|
800
|
+
enumerable: true,
|
|
801
|
+
get: function () { return auth0SpaJs.PopupOpenError; }
|
|
802
|
+
});
|
|
803
|
+
Object.defineProperty(exports, 'PopupTimeoutError', {
|
|
804
|
+
enumerable: true,
|
|
805
|
+
get: function () { return auth0SpaJs.PopupTimeoutError; }
|
|
806
|
+
});
|
|
807
|
+
Object.defineProperty(exports, 'ResponseType', {
|
|
808
|
+
enumerable: true,
|
|
809
|
+
get: function () { return auth0SpaJs.ResponseType; }
|
|
810
|
+
});
|
|
811
|
+
Object.defineProperty(exports, 'TimeoutError', {
|
|
812
|
+
enumerable: true,
|
|
813
|
+
get: function () { return auth0SpaJs.TimeoutError; }
|
|
814
|
+
});
|
|
815
|
+
Object.defineProperty(exports, 'UseDpopNonceError', {
|
|
816
|
+
enumerable: true,
|
|
817
|
+
get: function () { return auth0SpaJs.UseDpopNonceError; }
|
|
818
|
+
});
|
|
819
|
+
Object.defineProperty(exports, 'User', {
|
|
820
|
+
enumerable: true,
|
|
821
|
+
get: function () { return auth0SpaJs.User; }
|
|
822
|
+
});
|
|
823
|
+
exports.Auth0Context = Auth0Context;
|
|
824
|
+
exports.Auth0Provider = Auth0Provider;
|
|
825
|
+
exports.OAuthError = OAuthError;
|
|
826
|
+
exports.initialContext = initialContext;
|
|
827
|
+
exports.useAuth0 = useAuth0;
|
|
828
|
+
exports.withAuth0 = withAuth0;
|
|
829
|
+
exports.withAuthenticationRequired = withAuthenticationRequired;
|
|
830
|
+
//# sourceMappingURL=auth0-react.cjs.js.map
|