-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathuse-auth0.ts
39 lines (37 loc) · 975 Bytes
/
use-auth0.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { useContext } from 'react';
import Auth0Context, { Auth0ContextInterface } from './auth0-context';
/**
* Use the `useAuth0` in your function components to access authentication state and methods.
* @returns {Auth0ContextInterface} The useAuth0 hook interface
*
* ```ts
* const {
* // State
* error,
* user,
* isLoading,
* // Methods
* authorize,
* sendSMSCode,
* authorizeWithSMS,
* sendEmailCode,
* authorizeWithEmail,
* sendMultifactorChallenge,
* authorizeWithOOB,
* authorizeWithOTP,
* authorizeWithRecoveryCode,
* hasValidCredentials,
* clearSession,
* getCredentials,
* clearCredentials,
* requireLocalAuthentication,
* authorizeWithPasswordRealm,
* authorizeWithExchangeNativeSocial,
* revokeRefreshToken
* } = useAuth0();
* ```
*
* Refer to {@link Auth0ContextInterface} on how to use the above methods.
*/
const useAuth0 = () => useContext(Auth0Context);
export default useAuth0;