@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
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An OAuth2 error will come from the authorization server and will have at least an `error` property which will
|
|
3
|
+
* be the error code. And possibly an `error_description` property
|
|
4
|
+
*
|
|
5
|
+
* See: https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.6
|
|
6
|
+
*/
|
|
7
|
+
export declare class OAuthError extends Error {
|
|
8
|
+
error: string;
|
|
9
|
+
error_description?: string | undefined;
|
|
10
|
+
constructor(error: string, error_description?: string | undefined);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAChB,KAAK,EAAE,MAAM;IAAS,iBAAiB,CAAC,EAAE,MAAM;gBAAhD,KAAK,EAAE,MAAM,EAAS,iBAAiB,CAAC,EAAE,MAAM,YAAA;CAMpE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as Auth0Provider, Auth0ProviderOptions, Auth0ProviderWithConfigOptions, Auth0ProviderWithClientOptions, AppState, ConnectedAccount } from './auth0-provider';
|
|
2
|
+
export { default as useAuth0 } from './use-auth0';
|
|
3
|
+
export { default as withAuth0, WithAuth0Props } from './with-auth0';
|
|
4
|
+
export { default as withAuthenticationRequired, WithAuthenticationRequiredOptions, } from './with-authentication-required';
|
|
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';
|
|
8
|
+
export { OAuthError } from './errors';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,EACrB,QAAQ,EACR,mBAAmB,EAEnB,QAAQ,EACR,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EAEzB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EAEpB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,aAAa,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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { User } from '@auth0/auth0-spa-js';
|
|
2
|
+
import { AuthState } from './auth-state';
|
|
3
|
+
type Action = {
|
|
4
|
+
type: 'LOGIN_POPUP_STARTED';
|
|
5
|
+
} | {
|
|
6
|
+
type: 'INITIALISED' | 'LOGIN_POPUP_COMPLETE' | 'GET_ACCESS_TOKEN_COMPLETE' | 'HANDLE_REDIRECT_COMPLETE';
|
|
7
|
+
user: User | undefined;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'LOGOUT';
|
|
10
|
+
} | {
|
|
11
|
+
type: 'ERROR';
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Handles how that state changes in the `useAuth0` hook.
|
|
16
|
+
*/
|
|
17
|
+
export declare const reducer: <TUser extends User = User>(state: AuthState<TUser>, action: Action) => AuthState<TUser>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +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;IAC/B,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,CAuC3G,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { User } from '@auth0/auth0-spa-js';
|
|
2
|
+
import { Auth0ContextInterface } from './auth0-context';
|
|
3
|
+
/**
|
|
4
|
+
* ```js
|
|
5
|
+
* const {
|
|
6
|
+
* // Auth state:
|
|
7
|
+
* error,
|
|
8
|
+
* isAuthenticated,
|
|
9
|
+
* isLoading,
|
|
10
|
+
* user,
|
|
11
|
+
* // Auth methods:
|
|
12
|
+
* getAccessTokenSilently,
|
|
13
|
+
* getAccessTokenWithPopup,
|
|
14
|
+
* getIdTokenClaims,
|
|
15
|
+
* loginWithCustomTokenExchange,
|
|
16
|
+
* exchangeToken, // deprecated - use loginWithCustomTokenExchange
|
|
17
|
+
* loginWithRedirect,
|
|
18
|
+
* loginWithPopup,
|
|
19
|
+
* logout,
|
|
20
|
+
* } = useAuth0<TUser>();
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Use the `useAuth0` hook in your components to access the auth state and methods.
|
|
24
|
+
*
|
|
25
|
+
* TUser is an optional type param to provide a type to the `user` field.
|
|
26
|
+
*/
|
|
27
|
+
declare const useAuth0: <TUser extends User = User>(context?: import("react").Context<Auth0ContextInterface<User>>) => Auth0ContextInterface<TUser>;
|
|
28
|
+
export default useAuth0;
|
|
29
|
+
//# sourceMappingURL=use-auth0.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-auth0.d.ts","sourceRoot":"","sources":["../src/use-auth0.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,QAAQ,GAAI,KAAK,SAAS,IAAI,GAAG,IAAI,EACzC,8DAAsB,KACrB,qBAAqB,CAAC,KAAK,CACuB,CAAC;AAEtD,eAAe,QAAQ,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const hasAuthParams: (searchParams?: string) => boolean;
|
|
2
|
+
export declare const loginError: (error: unknown) => Error;
|
|
3
|
+
export declare const tokenError: (error: unknown) => Error;
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
* Helper function to map the v1 `redirectUri` option to the v2 `authorizationParams.redirect_uri`
|
|
7
|
+
* and log a warning.
|
|
8
|
+
*/
|
|
9
|
+
export declare const deprecateRedirectUri: (options?: any) => void;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,GAAI,qBAAqC,KAAG,OAEzC,CAAC;AA4B9B,eAAO,MAAM,UAAU,UAxBb,OAAO,KAAG,KAwBsC,CAAC;AAE3D,eAAO,MAAM,UAAU,UA1Bb,OAAO,KAAG,KA0BiD,CAAC;AAEtE;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,GAAI,UAAU,GAAG,SAkBjD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
import { Auth0ContextInterface } from './auth0-context';
|
|
3
|
+
/**
|
|
4
|
+
* Components wrapped in `withAuth0` will have an additional `auth0` prop
|
|
5
|
+
*/
|
|
6
|
+
export interface WithAuth0Props {
|
|
7
|
+
auth0: Auth0ContextInterface;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* ```jsx
|
|
11
|
+
* class MyComponent extends Component {
|
|
12
|
+
* render() {
|
|
13
|
+
* // Access the auth context from the `auth0` prop
|
|
14
|
+
* const { user } = this.props.auth0;
|
|
15
|
+
* return <div>Hello {user.name}!</div>
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* // Wrap your class component in withAuth0
|
|
19
|
+
* export default withAuth0(MyComponent);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Wrap your class components in this Higher Order Component to give them access to the Auth0Context.
|
|
23
|
+
*
|
|
24
|
+
* Providing a context as the second argument allows you to configure the Auth0Provider the Auth0Context
|
|
25
|
+
* should come from f you have multiple within your application.
|
|
26
|
+
*/
|
|
27
|
+
declare const withAuth0: <P extends WithAuth0Props>(Component: ComponentType<P>, context?: React.Context<Auth0ContextInterface<import("@auth0/auth0-spa-js").User>>) => ComponentType<Omit<P, keyof WithAuth0Props>>;
|
|
28
|
+
export default withAuth0;
|
|
29
|
+
//# sourceMappingURL=with-auth0.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-auth0.d.ts","sourceRoot":"","sources":["../src/with-auth0.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,cAAc,EACzC,WAAW,aAAa,CAAC,CAAC,CAAC,EAC3B,kFAAsB,KACrB,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,cAAc,CAAC,CAU7C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { ComponentType, FC } from 'react';
|
|
2
|
+
import { Auth0ContextInterface, RedirectLoginOptions } from './auth0-context';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the withAuthenticationRequired Higher Order Component
|
|
5
|
+
*/
|
|
6
|
+
export interface WithAuthenticationRequiredOptions {
|
|
7
|
+
/**
|
|
8
|
+
* ```js
|
|
9
|
+
* withAuthenticationRequired(Profile, {
|
|
10
|
+
* returnTo: '/profile'
|
|
11
|
+
* })
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* or
|
|
15
|
+
*
|
|
16
|
+
* ```js
|
|
17
|
+
* withAuthenticationRequired(Profile, {
|
|
18
|
+
* returnTo: () => window.location.hash.substr(1)
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Add a path for the `onRedirectCallback` handler to return the user to after login.
|
|
23
|
+
*/
|
|
24
|
+
returnTo?: string | (() => string);
|
|
25
|
+
/**
|
|
26
|
+
* ```js
|
|
27
|
+
* withAuthenticationRequired(Profile, {
|
|
28
|
+
* onRedirecting: () => <div>Redirecting you to the login...</div>
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Render a message to show that the user is being redirected to the login.
|
|
33
|
+
*/
|
|
34
|
+
onRedirecting?: () => React.JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* ```js
|
|
37
|
+
* withAuthenticationRequired(Profile, {
|
|
38
|
+
* onBeforeAuthentication: () => { analyticsLibrary.track('login_triggered'); }
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* Allows executing logic before the user is redirected to the login page.
|
|
43
|
+
*/
|
|
44
|
+
onBeforeAuthentication?: () => Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* ```js
|
|
47
|
+
* withAuthenticationRequired(Profile, {
|
|
48
|
+
* loginOptions: {
|
|
49
|
+
* appState: {
|
|
50
|
+
* customProp: 'foo'
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
* })
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* Pass additional login options, like extra `appState` to the login page.
|
|
57
|
+
* This will be merged with the `returnTo` option used by the `onRedirectCallback` handler.
|
|
58
|
+
*/
|
|
59
|
+
loginOptions?: RedirectLoginOptions;
|
|
60
|
+
/**
|
|
61
|
+
* The context to be used when calling useAuth0, this should only be provided if you are using multiple Auth0Providers
|
|
62
|
+
* within your application and you wish to tie a specific component to a Auth0Provider other than the Auth0Provider
|
|
63
|
+
* associated with the default Auth0Context.
|
|
64
|
+
*/
|
|
65
|
+
context?: React.Context<Auth0ContextInterface>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* ```js
|
|
69
|
+
* const MyProtectedComponent = withAuthenticationRequired(MyComponent);
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* When you wrap your components in this Higher Order Component and an anonymous user visits your component
|
|
73
|
+
* they will be redirected to the login page; after login they will be returned to the page they were redirected from.
|
|
74
|
+
*/
|
|
75
|
+
declare const withAuthenticationRequired: <P extends object>(Component: ComponentType<P>, options?: WithAuthenticationRequiredOptions) => FC<P>;
|
|
76
|
+
export default withAuthenticationRequired;
|
|
77
|
+
//# sourceMappingURL=with-authentication-required.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-authentication-required.d.ts","sourceRoot":"","sources":["../src/with-authentication-required.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAa,EAAE,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAqB,EACnB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAkBzB;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACnC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAClD,WAAW,aAAa,CAAC,CAAC,CAAC,EAC3B,UAAS,iCAAsC,KAC9C,EAAE,CAAC,CAAC,CAuCN,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Auth0",
|
|
3
|
+
"name": "@versini/auth0-react-thin",
|
|
4
|
+
"version": "2.19.0",
|
|
5
|
+
"description": "Auth0 SDK for React Single Page Applications (SPA)",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"auth0",
|
|
8
|
+
"login",
|
|
9
|
+
"Authorization Code Grant Flow",
|
|
10
|
+
"PKCE",
|
|
11
|
+
"Single Page Application authentication",
|
|
12
|
+
"SPA authentication",
|
|
13
|
+
"react"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"main": "dist/auth0-react.cjs.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"module": "dist/auth0-react.esm.js",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/versini-org/auth0-thin.git",
|
|
25
|
+
"directory": "forks/auth0-react"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/auth0/auth0-react/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/versini-org/auth0-thin#readme",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^16.11.0 || ^17 || ^18 || ~19.0.1 || ~19.1.2 || ^19.2.1",
|
|
34
|
+
"react-dom": "^16.11.0 || ^17 || ^18 || ~19.0.1 || ~19.1.2 || ^19.2.1"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@auth0/auth0-spa-js": "^2.21.2"
|
|
38
|
+
},
|
|
39
|
+
"forkedFrom": "@auth0/auth0-react@2.19.0",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { User } from '@auth0/auth0-spa-js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The auth state which, when combined with the auth methods, make up the return object of the `useAuth0` hook.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthState<TUser extends User = User> {
|
|
7
|
+
error: Error | undefined;
|
|
8
|
+
isAuthenticated: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
user: TUser | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The initial auth state.
|
|
15
|
+
*/
|
|
16
|
+
export const initialAuthState: AuthState = {
|
|
17
|
+
isAuthenticated: false,
|
|
18
|
+
isLoading: true,
|
|
19
|
+
error: undefined,
|
|
20
|
+
user: undefined,
|
|
21
|
+
};
|