-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthConfig.js
145 lines (124 loc) · 4.65 KB
/
authConfig.js
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Thank you for using authjs
/*
*************************************************************************************
If you dont have your authConfig file yet, follow the below mentioned steps :
1. Create a file named 'authConfig.js' in the same directory as of the nodemodules
(Your root directory)
2. For easy going, I recommend you to copy-paste this files' contents as it is into
your authConfig file :-)
NOTE : Once you copy all the contents from this file, setting up your
dataBaseConfiguration object is mandatory.
However, you can either set the mailConfiguration object or the smsConfiguration
object or both!
***************
Based on which configuration object you set, uncomment the corresponding export line at the bottom of this file!
***************
*************************************************************************************
*/
// dataBaseConfiguration is mandatory!
const dataBaseConfiguration = {
dataBase: '',
/* 'postgresql' or 'mongodb' */
connectionString: ''
// Required to connect to the data base you choose...
/*
'postgresql://dbuser:[email protected]:port/mydb'
or
'mongodb+srv://dbuser:[email protected]/mydb?retryWrites=true'
*/
}
/*
You can either choose to take in user's email address during signUp and send them a
verification link or take in user's phone number and send them an OTP for verification
or handle both of them...
However, I recommend you to opt for both the ways!!!
*/
// Ensure that you atleast set one of the configuration objects...
// Set up the mailConfiguration object for sending verification links to the user provided email address
/*
************************************************
The verification link sent is valid for 12 hours
************************************************
*/
const mailConfiguration = {
mailer: '',
/* mailgun or sendgrid */
apiKey: '',
/*
Provide your private key here
example : 'XXXXXX2b71XXXXXX90994f135XXXXXXX-XX78XXXX-XX713XXX'
*/
domain: '',
// Required only if the mailer is set to mailgun
/*
Provide your sandbox/custom domain name (mailgun)
example : 'sandboxXXXXXX392eXXXXXXXX4459fa2cXXXXXX.mailgun.org'
*/
from: '',
/*
Format : 'Name <[email protected]>'
If not provided, the folowing defaults will be used -
Default : 'Verifier <[email protected]>', in the case of mailgun
'Verifier <[email protected]>', in the case of sendgrid
*/
organizationName: '',
/*
Provide your organization name by means of which the user recognizes
the source of the verification link sent to him/her
If not provided, 'TESTING' would be used as the default name
*/
route: ''
/*
Provide the route which will be sent as the verification link(with a token suffixed) to the users email address; (You will need to handle this route as authjs needs this token for verification)
*********************************************************************************
NOTE :
Your route will be suffixed by a 32 character long token
i.e if you provide your route as : http://localhost:3000/verify,
it will be transformed to : http://localhost:3000/verifiy/01234567890123456789012
345678901234, where 01234567890123456789012345678901234 is the token!
**********************************************************************************
*/
}
// Set up the smsConfiguration object for sending OTPs to the user provided phone number
/*
************************************************
The OTP sent is valid for 10 minutes
************************************************
*/
const smsConfiguration = {
sender: '',
/* nexmo or twilio */
from: '',
/*
A Valid phone number in the format :
[+][country code][phone number including area code] or shortcode, or alphanumeric sender
*/
organizationName: '',
/*
Provide your organization name by means of which the user recognizes
the source of the OTP sent to him/her
If not provided, 'TESTING' would be used as the default name
*/
// Nexmo
apiKey: '',
apiSecret: '',
/*
If you have set the sender as 'nexmo',
Provide your Nexmo's apiKey and apiSecret
*/
// Twilio
accountSid: '',
authToken: ''
/*
If you have set the sender as 'twilio',
Provide your Twilios's accountSid and authToken
*/
}
/*
Uncomment the exports based on what you have chosen and configured
*/
module.exports = {
dataBaseConfiguration,
// mailConfiguration, // Uncomment this line, if you are using the mailConfiguration
// smsConfiguration // Uncomment this line, if you are using the smsConfiguration
}