-
Notifications
You must be signed in to change notification settings - Fork 27k
/
backend.ts
89 lines (87 loc) · 2.92 KB
/
backend.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import ThirdPartyEmailPasswordNode from 'supertokens-node/recipe/thirdpartyemailpassword'
import SessionNode from 'supertokens-node/recipe/session'
import Dashboard from 'supertokens-node/recipe/dashboard'
import { appInfo } from './appInfo'
import { TypeInput } from 'supertokens-node/types'
import SuperTokens from 'supertokens-node'
export let backendConfig = (): TypeInput => {
return {
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: 'https://try.supertokens.com',
},
appInfo,
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
ThirdPartyEmailPasswordNode.init({
providers: [
// We have provided you with development keys which you can use for testing.
// IMPORTANT: Please replace them with your own OAuth keys for production use.
{
config: {
thirdPartyId: 'google',
clients: [
{
clientId:
'1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com',
clientSecret: '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',
},
],
},
},
{
config: {
thirdPartyId: 'github',
clients: [
{
clientId: '467101b197249757c71f',
clientSecret: 'e97051221f4b6426e8fe8d51486396703012f5bd',
},
],
},
},
{
config: {
thirdPartyId: 'apple',
clients: [
{
clientId: '4398792-io.supertokens.example.service',
additionalConfig: {
keyId: '7M48Y4RYDL',
privateKey:
'-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----',
teamId: 'YWQCXGJRJL',
},
},
],
},
},
{
config: {
thirdPartyId: 'twitter',
clients: [
{
clientId: '4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ',
clientSecret:
'BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC',
},
],
},
},
],
}),
SessionNode.init(),
Dashboard.init(),
],
isInServerlessEnv: true,
framework: 'custom',
}
}
let initialized = false
export function ensureSuperTokensInit() {
if (!initialized) {
SuperTokens.init(backendConfig())
initialized = true
}
}