-
Notifications
You must be signed in to change notification settings - Fork 369
/
instance.ts
74 lines (63 loc) · 1.67 KB
/
instance.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { GetSession, GetAccessToken, UpdateSession } from './session';
import { WithApiAuthRequired, WithPageAuthRequired } from './helpers';
import { HandleAuth, HandleCallback, HandleLogin, HandleLogout, HandleProfile } from './handlers';
import { ConfigParameters } from './auth0-session';
/**
* The SDK server instance.
*
* This is created for you when you use the named exports, or you can create your own using {@link InitAuth0}.
*
* See {@link ConfigParameters} for more info.
*
* @category Server
*/
export interface SignInWithAuth0 {
/**
* Session getter.
*/
getSession: GetSession;
/**
* Append properties to the user.
*/
updateSession: UpdateSession;
/**
* Access token getter.
*/
getAccessToken: GetAccessToken;
/**
* Login handler which will redirect the user to Auth0.
*/
handleLogin: HandleLogin;
/**
* Callback handler which will complete the transaction and create a local session.
*/
handleCallback: HandleCallback;
/**
* Logout handler which will clear the local session and the Auth0 session.
*/
handleLogout: HandleLogout;
/**
* Profile handler which return profile information about the user.
*/
handleProfile: HandleProfile;
/**
* Helper that adds auth to an API route.
*/
withApiAuthRequired: WithApiAuthRequired;
/**
* Helper that adds auth to a Page route.
*/
withPageAuthRequired: WithPageAuthRequired;
/**
* Create the main handlers for your api routes.
*/
handleAuth: HandleAuth;
}
/**
* Initialise your own instance of the SDK.
*
* See {@link ConfigParameters}.
*
* @category Server
*/
export type InitAuth0 = (params?: ConfigParameters) => SignInWithAuth0;