@versini/auth0-react-thin 2.20.0 → 2.22.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/README.md +1 -1
- package/dist/auth0-context.d.ts +30 -1
- package/dist/auth0-context.d.ts.map +1 -1
- package/dist/auth0-provider.d.ts.map +1 -1
- package/dist/auth0-react.cjs.js +54 -3
- package/dist/auth0-react.cjs.js.map +1 -1
- package/dist/auth0-react.esm.js +43 -4
- package/dist/auth0-react.esm.js.map +1 -1
- package/dist/auth0-react.js +46 -4
- package/dist/auth0-react.js.map +1 -1
- package/dist/auth0-react.min.js +1 -1
- package/dist/auth0-react.min.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/reducer.d.ts +1 -1
- package/dist/reducer.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/auth0-context.tsx +31 -0
- package/src/auth0-provider.tsx +23 -0
- package/src/index.tsx +4 -0
- package/src/reducer.tsx +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { default as useAuth0 } from './use-auth0';
|
|
|
3
3
|
export { default as withAuth0, WithAuth0Props } from './with-auth0';
|
|
4
4
|
export { default as withAuthenticationRequired, WithAuthenticationRequiredOptions, } from './with-authentication-required';
|
|
5
5
|
export { default as Auth0Context, Auth0ContextInterface, initialContext, LogoutOptions, RedirectLoginOptions, } from './auth0-context';
|
|
6
|
-
export { AuthorizationParams, PopupLoginOptions, PopupConfigOptions, GetTokenWithPopupOptions, LogoutUrlOptions, CacheLocation, GetTokenSilentlyOptions, IdToken, User, ICache, InMemoryCache, LocalStorageCache, Cacheable, TimeoutError, MfaRequiredError, PopupCancelledError, PopupTimeoutError, PopupOpenError, AuthenticationError, MissingRefreshTokenError, GenericError, UseDpopNonceError, RedirectConnectAccountOptions, ConnectAccountRedirectResult, ResponseType, ConnectError, CustomTokenExchangeOptions, TokenEndpointResponse, ActClaim, ClientConfiguration, MfaError, MfaListAuthenticatorsError, MfaEnrollmentError, MfaChallengeError, MfaVerifyError, MfaEnrollmentFactorsError, PasskeyError, PasskeyRegisterError, PasskeyChallengeError, PasskeyGetTokenError, MyAccountApiError, } from '@auth0/auth0-spa-js';
|
|
7
|
-
export type { FetcherConfig, InteractiveErrorHandler, MfaApiClient, Authenticator, MfaFactorType, EnrollParams, EnrollOtpParams, EnrollSmsParams, EnrollVoiceParams, EnrollEmailParams, EnrollPushParams, EnrollmentResponse, ChallengeAuthenticatorParams, ChallengeResponse, VerifyParams, EnrollmentFactor, PasskeyApiClient, PasskeySignupOptions, PasskeyLoginOptions, MyAccountApiClient, AuthenticationMethod, AuthenticationMethodType, Factor, UpdateAuthenticationMethodRequest, EnrollmentChallengeOptions, EnrollmentChallengeResponse, EnrollmentVerifyOptions, } from '@auth0/auth0-spa-js';
|
|
6
|
+
export { AuthorizationParams, PopupLoginOptions, PopupConfigOptions, GetTokenWithPopupOptions, LogoutUrlOptions, CacheLocation, GetTokenSilentlyOptions, IdToken, User, ICache, InMemoryCache, LocalStorageCache, Cacheable, TimeoutError, MfaRequiredError, PopupCancelledError, PopupTimeoutError, PopupOpenError, AuthenticationError, MissingRefreshTokenError, MissingScopesError, InvalidConfigurationError, GenericError, UseDpopNonceError, RedirectConnectAccountOptions, ConnectAccountRedirectResult, ResponseType, ConnectError, CustomTokenExchangeOptions, TokenEndpointResponse, ActClaim, ClientConfiguration, RefreshTokenMode, MfaError, MfaListAuthenticatorsError, MfaEnrollmentError, MfaChallengeError, MfaVerifyError, MfaEnrollmentFactorsError, PasskeyError, PasskeyRegisterError, PasskeyChallengeError, PasskeyGetTokenError, MyAccountApiError, } from '@auth0/auth0-spa-js';
|
|
7
|
+
export type { RevokeRefreshTokenOptions, FetcherConfig, InteractiveErrorHandler, MfaApiClient, Authenticator, MfaFactorType, EnrollParams, EnrollOtpParams, EnrollSmsParams, EnrollVoiceParams, EnrollEmailParams, EnrollPushParams, EnrollmentResponse, ChallengeAuthenticatorParams, ChallengeResponse, VerifyParams, EnrollmentFactor, PasskeyApiClient, PasskeySignupOptions, PasskeyLoginOptions, MyAccountApiClient, AuthenticationMethod, AuthenticationMethodType, Factor, UpdateAuthenticationMethodRequest, EnrollmentChallengeOptions, EnrollmentChallengeResponse, EnrollmentVerifyOptions, } from '@auth0/auth0-spa-js';
|
|
8
8
|
export { OAuthError } from './errors';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,aAAa,EACxB,oBAAoB,EACpB,8BAA8B,EAC9B,8BAA8B,EAC9B,QAAQ,EACR,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,OAAO,IAAI,0BAA0B,EACrC,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,OAAO,EACP,IAAI,EACJ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,6BAA6B,EAC7B,4BAA4B,EAC5B,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB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Aa,EACb,uBAAuB,EAEvB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAEhB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EAEnB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,EACN,iCAAiC,EACjC,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/reducer.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AuthState } from './auth-state';
|
|
|
3
3
|
type Action = {
|
|
4
4
|
type: 'LOGIN_POPUP_STARTED';
|
|
5
5
|
} | {
|
|
6
|
-
type: 'INITIALISED' | 'LOGIN_POPUP_COMPLETE' | 'GET_ACCESS_TOKEN_COMPLETE' | 'HANDLE_REDIRECT_COMPLETE';
|
|
6
|
+
type: 'INITIALISED' | 'LOGIN_POPUP_COMPLETE' | 'GET_ACCESS_TOKEN_COMPLETE' | 'HANDLE_REDIRECT_COMPLETE' | 'SYNC_USER';
|
|
7
7
|
user: User | undefined;
|
|
8
8
|
} | {
|
|
9
9
|
type: 'LOGOUT';
|
package/dist/reducer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,KAAK,MAAM,GACP;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,GAC/B;IACE,IAAI,EACA,aAAa,GACb,sBAAsB,GACtB,2BAA2B,GAC3B,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,KAAK,MAAM,GACP;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,GAC/B;IACE,IAAI,EACA,aAAa,GACb,sBAAsB,GACtB,2BAA2B,GAC3B,0BAA0B,GAC1B,WAAW,CAAC;IAChB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;CACxB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,KAAK,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,SAAS,CAAC,KAAK,CAAC,EAAE,QAAQ,MAAM,KAAG,SAAS,CAAC,KAAK,CAwC3G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Auth0",
|
|
3
3
|
"name": "@versini/auth0-react-thin",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"description": "Unofficial slim fork of @auth0/auth0-react@2.
|
|
4
|
+
"version": "2.22.0",
|
|
5
|
+
"description": "Unofficial slim fork of @auth0/auth0-react@2.22.0 — bundle-size build, not affiliated with Auth0/Okta. See @versini/auth0-thin.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"auth0",
|
|
8
8
|
"fork",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"react-dom": "^16.11.0 || ^17 || ^18 || ~19.0.1 || ~19.1.2 || ^19.2.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@auth0/auth0-spa-js": "^2.
|
|
35
|
+
"@auth0/auth0-spa-js": "^2.23.0"
|
|
36
36
|
},
|
|
37
|
-
"forkedFrom": "@auth0/auth0-react@2.
|
|
37
|
+
"forkedFrom": "@auth0/auth0-react@2.22.0",
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
}
|
package/src/auth0-context.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
ConnectAccountRedirectResult,
|
|
15
15
|
CustomTokenExchangeOptions,
|
|
16
16
|
TokenEndpointResponse,
|
|
17
|
+
type RevokeRefreshTokenOptions,
|
|
17
18
|
type MfaApiClient,
|
|
18
19
|
type PasskeyApiClient,
|
|
19
20
|
type MyAccountApiClient
|
|
@@ -273,6 +274,35 @@ export interface Auth0ContextInterface<TUser extends User = User>
|
|
|
273
274
|
*/
|
|
274
275
|
logout: (options?: LogoutOptions) => Promise<void>;
|
|
275
276
|
|
|
277
|
+
/**
|
|
278
|
+
* ```js
|
|
279
|
+
* await revokeRefreshToken();
|
|
280
|
+
* // or for a specific audience:
|
|
281
|
+
* await revokeRefreshToken({ audience: 'https://api.example.com' });
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* Revokes the refresh token via the `/oauth/revoke` endpoint. This invalidates the
|
|
285
|
+
* refresh token so it can no longer be used to obtain new access tokens.
|
|
286
|
+
*
|
|
287
|
+
* If `useRefreshTokens` is disabled, this method does nothing.
|
|
288
|
+
* When multiple audiences share the same refresh token, revoking for
|
|
289
|
+
* one audience invalidates it for all of them.
|
|
290
|
+
*
|
|
291
|
+
* **Online mode** (`refreshTokenMode: RefreshTokenMode.Online`): revoking the Online
|
|
292
|
+
* Refresh Token also terminates the Auth0 session server-side and clears the entire
|
|
293
|
+
* local cache. `isAuthenticated` and `user` update immediately to reflect the
|
|
294
|
+
* terminated session — no redirect required. Use `logout()` instead if you want a
|
|
295
|
+
* redirect-based sign-out.
|
|
296
|
+
*
|
|
297
|
+
* **Offline mode**: only the refresh token is invalidated; the cached access token
|
|
298
|
+
* and user profile remain valid until the access token expires. `isAuthenticated`
|
|
299
|
+
* and `user` are unaffected until then.
|
|
300
|
+
*
|
|
301
|
+
* @param options - Optional parameters to identify which refresh token to revoke.
|
|
302
|
+
* Defaults to the audience configured in `authorizationParams`.
|
|
303
|
+
*/
|
|
304
|
+
revokeRefreshToken: (options?: RevokeRefreshTokenOptions) => Promise<void>;
|
|
305
|
+
|
|
276
306
|
/**
|
|
277
307
|
* After the browser redirects back to the callback page,
|
|
278
308
|
* call `handleRedirectCallback` to handle success and error
|
|
@@ -470,6 +500,7 @@ export const initialContext = {
|
|
|
470
500
|
loginWithPopup: stub,
|
|
471
501
|
connectAccountWithRedirect: stub,
|
|
472
502
|
logout: stub,
|
|
503
|
+
revokeRefreshToken: stub,
|
|
473
504
|
handleRedirectCallback: stub,
|
|
474
505
|
getDpopNonce: stub,
|
|
475
506
|
setDpopNonce: stub,
|
package/src/auth0-provider.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ResponseType,
|
|
21
21
|
CustomTokenExchangeOptions,
|
|
22
22
|
TokenEndpointResponse,
|
|
23
|
+
type RevokeRefreshTokenOptions,
|
|
23
24
|
type PasskeyApiClient,
|
|
24
25
|
type PasskeySignupOptions,
|
|
25
26
|
type PasskeyLoginOptions
|
|
@@ -259,6 +260,26 @@ const Auth0Provider = <TUser extends User = User>(opts: Auth0ProviderOptions<TUs
|
|
|
259
260
|
[client]
|
|
260
261
|
);
|
|
261
262
|
|
|
263
|
+
const revokeRefreshToken = useCallback(
|
|
264
|
+
async (opts?: RevokeRefreshTokenOptions): Promise<void> => {
|
|
265
|
+
try {
|
|
266
|
+
await client.revokeRefreshToken(opts);
|
|
267
|
+
} finally {
|
|
268
|
+
// Online mode clears the entire local session as part of revocation; offline
|
|
269
|
+
// mode leaves the cached access token/user untouched. Re-reading the user from
|
|
270
|
+
// the client after either case keeps isAuthenticated/user consistent with
|
|
271
|
+
// whatever the SDK actually did, without assuming which mode is active. If
|
|
272
|
+
// revocation fails, nothing was actually revoked, so this re-read simply
|
|
273
|
+
// reflects the unchanged cached user/session.
|
|
274
|
+
dispatch({
|
|
275
|
+
type: 'SYNC_USER',
|
|
276
|
+
user: await client.getUser(),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
[client]
|
|
281
|
+
);
|
|
282
|
+
|
|
262
283
|
const getAccessTokenSilently = useCallback(
|
|
263
284
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
264
285
|
async (opts?: GetTokenSilentlyOptions): Promise<any> => {
|
|
@@ -449,6 +470,7 @@ const Auth0Provider = <TUser extends User = User>(opts: Auth0ProviderOptions<TUs
|
|
|
449
470
|
loginWithPopup,
|
|
450
471
|
connectAccountWithRedirect,
|
|
451
472
|
logout,
|
|
473
|
+
revokeRefreshToken,
|
|
452
474
|
handleRedirectCallback,
|
|
453
475
|
getDpopNonce,
|
|
454
476
|
setDpopNonce,
|
|
@@ -471,6 +493,7 @@ const Auth0Provider = <TUser extends User = User>(opts: Auth0ProviderOptions<TUs
|
|
|
471
493
|
loginWithPopup,
|
|
472
494
|
connectAccountWithRedirect,
|
|
473
495
|
logout,
|
|
496
|
+
revokeRefreshToken,
|
|
474
497
|
handleRedirectCallback,
|
|
475
498
|
getDpopNonce,
|
|
476
499
|
setDpopNonce,
|
package/src/index.tsx
CHANGED
|
@@ -40,6 +40,8 @@ export {
|
|
|
40
40
|
PopupOpenError,
|
|
41
41
|
AuthenticationError,
|
|
42
42
|
MissingRefreshTokenError,
|
|
43
|
+
MissingScopesError,
|
|
44
|
+
InvalidConfigurationError,
|
|
43
45
|
GenericError,
|
|
44
46
|
UseDpopNonceError,
|
|
45
47
|
RedirectConnectAccountOptions,
|
|
@@ -50,6 +52,7 @@ export {
|
|
|
50
52
|
TokenEndpointResponse,
|
|
51
53
|
ActClaim,
|
|
52
54
|
ClientConfiguration,
|
|
55
|
+
RefreshTokenMode,
|
|
53
56
|
// MFA Errors
|
|
54
57
|
MfaError,
|
|
55
58
|
MfaListAuthenticatorsError,
|
|
@@ -66,6 +69,7 @@ export {
|
|
|
66
69
|
MyAccountApiError,
|
|
67
70
|
} from '@auth0/auth0-spa-js';
|
|
68
71
|
export type {
|
|
72
|
+
RevokeRefreshTokenOptions,
|
|
69
73
|
FetcherConfig,
|
|
70
74
|
InteractiveErrorHandler,
|
|
71
75
|
// MFA Types
|
package/src/reducer.tsx
CHANGED
|
@@ -8,7 +8,8 @@ type Action =
|
|
|
8
8
|
| 'INITIALISED'
|
|
9
9
|
| 'LOGIN_POPUP_COMPLETE'
|
|
10
10
|
| 'GET_ACCESS_TOKEN_COMPLETE'
|
|
11
|
-
| 'HANDLE_REDIRECT_COMPLETE'
|
|
11
|
+
| 'HANDLE_REDIRECT_COMPLETE'
|
|
12
|
+
| 'SYNC_USER';
|
|
12
13
|
user: User | undefined;
|
|
13
14
|
}
|
|
14
15
|
| { type: 'LOGOUT' }
|
|
@@ -35,6 +36,7 @@ export const reducer = <TUser extends User = User>(state: AuthState<TUser>, acti
|
|
|
35
36
|
};
|
|
36
37
|
case 'HANDLE_REDIRECT_COMPLETE':
|
|
37
38
|
case 'GET_ACCESS_TOKEN_COMPLETE':
|
|
39
|
+
case 'SYNC_USER':
|
|
38
40
|
if (state.user === action.user) {
|
|
39
41
|
return state;
|
|
40
42
|
}
|