@@ -25,7 +25,7 @@ function defaultGenerateCallbackUriParams (callbackUriParams) {
25
25
return callbackUriParams
26
26
}
27
27
28
- const oauthPlugin = fp ( function ( fastify , options , next ) {
28
+ function fastifyOauth2 ( fastify , options , next ) {
29
29
if ( typeof options . name !== 'string' ) {
30
30
return next ( new Error ( 'options.name should be a string' ) )
31
31
}
@@ -152,12 +152,9 @@ const oauthPlugin = fp(function (fastify, options, next) {
152
152
}
153
153
154
154
next ( )
155
- } , {
156
- fastify : '4.x' ,
157
- name : '@fastify/oauth2'
158
- } )
155
+ }
159
156
160
- oauthPlugin . APPLE_CONFIGURATION = {
157
+ fastifyOauth2 . APPLE_CONFIGURATION = {
161
158
authorizeHost : 'https://appleid.apple.com' ,
162
159
authorizePath : '/auth/authorize' ,
163
160
tokenHost : 'https://appleid.apple.com' ,
@@ -181,87 +178,92 @@ oauthPlugin.APPLE_CONFIGURATION = {
181
178
}
182
179
}
183
180
184
- oauthPlugin . FACEBOOK_CONFIGURATION = {
181
+ fastifyOauth2 . FACEBOOK_CONFIGURATION = {
185
182
authorizeHost : 'https://facebook.com' ,
186
183
authorizePath : '/v6.0/dialog/oauth' ,
187
184
tokenHost : 'https://graph.facebook.com' ,
188
185
tokenPath : '/v6.0/oauth/access_token'
189
186
}
190
187
191
- oauthPlugin . GITHUB_CONFIGURATION = {
188
+ fastifyOauth2 . GITHUB_CONFIGURATION = {
192
189
tokenHost : 'https://github.com' ,
193
190
tokenPath : '/login/oauth/access_token' ,
194
191
authorizePath : '/login/oauth/authorize'
195
192
}
196
193
197
- oauthPlugin . LINKEDIN_CONFIGURATION = {
194
+ fastifyOauth2 . LINKEDIN_CONFIGURATION = {
198
195
authorizeHost : 'https://www.linkedin.com' ,
199
196
authorizePath : '/oauth/v2/authorization' ,
200
197
tokenHost : 'https://www.linkedin.com' ,
201
198
tokenPath : '/oauth/v2/accessToken'
202
199
}
203
200
204
- oauthPlugin . GOOGLE_CONFIGURATION = {
201
+ fastifyOauth2 . GOOGLE_CONFIGURATION = {
205
202
authorizeHost : 'https://accounts.google.com' ,
206
203
authorizePath : '/o/oauth2/v2/auth' ,
207
204
tokenHost : 'https://www.googleapis.com' ,
208
205
tokenPath : '/oauth2/v4/token'
209
206
}
210
207
211
- oauthPlugin . MICROSOFT_CONFIGURATION = {
208
+ fastifyOauth2 . MICROSOFT_CONFIGURATION = {
212
209
authorizeHost : 'https://login.microsoftonline.com' ,
213
210
authorizePath : '/common/oauth2/v2.0/authorize' ,
214
211
tokenHost : 'https://login.microsoftonline.com' ,
215
212
tokenPath : '/common/oauth2/v2.0/token'
216
213
}
217
214
218
- oauthPlugin . VKONTAKTE_CONFIGURATION = {
215
+ fastifyOauth2 . VKONTAKTE_CONFIGURATION = {
219
216
authorizeHost : 'https://oauth.vk.com' ,
220
217
authorizePath : '/authorize' ,
221
218
tokenHost : 'https://oauth.vk.com' ,
222
219
tokenPath : '/access_token'
223
220
}
224
221
225
- oauthPlugin . SPOTIFY_CONFIGURATION = {
222
+ fastifyOauth2 . SPOTIFY_CONFIGURATION = {
226
223
authorizeHost : 'https://accounts.spotify.com' ,
227
224
authorizePath : '/authorize' ,
228
225
tokenHost : 'https://accounts.spotify.com' ,
229
226
tokenPath : '/api/token'
230
227
}
231
228
232
- oauthPlugin . DISCORD_CONFIGURATION = {
229
+ fastifyOauth2 . DISCORD_CONFIGURATION = {
233
230
authorizeHost : 'https://discord.com' ,
234
231
authorizePath : '/api/oauth2/authorize' ,
235
232
tokenHost : 'https://discord.com' ,
236
233
tokenPath : '/api/oauth2/token'
237
234
}
238
235
239
- oauthPlugin . TWITCH_CONFIGURATION = {
236
+ fastifyOauth2 . TWITCH_CONFIGURATION = {
240
237
authorizeHost : 'https://id.twitch.tv' ,
241
238
authorizePath : '/oauth2/authorize' ,
242
239
tokenHost : 'https://id.twitch.tv' ,
243
240
tokenPath : '/oauth2/token'
244
241
}
245
242
246
- oauthPlugin . VATSIM_CONFIGURATION = {
243
+ fastifyOauth2 . VATSIM_CONFIGURATION = {
247
244
authorizeHost : 'https://auth.vatsim.net' ,
248
245
authorizePath : '/oauth/authorize' ,
249
246
tokenHost : 'https://auth.vatsim.net' ,
250
247
tokenPath : '/oauth/token'
251
248
}
252
249
253
- oauthPlugin . VATSIM_DEV_CONFIGURATION = {
250
+ fastifyOauth2 . VATSIM_DEV_CONFIGURATION = {
254
251
authorizeHost : 'https://auth-dev.vatsim.net' ,
255
252
authorizePath : '/oauth/authorize' ,
256
253
tokenHost : 'https://auth-dev.vatsim.net' ,
257
254
tokenPath : '/oauth/token'
258
255
}
259
256
260
- oauthPlugin . EPIC_GAMES_CONFIGURATION = {
257
+ fastifyOauth2 . EPIC_GAMES_CONFIGURATION = {
261
258
authorizeHost : 'https://www.epicgames.com' ,
262
259
authorizePath : '/id/authorize' ,
263
260
tokenHost : 'https://api.epicgames.dev' ,
264
261
tokenPath : '/epic/oauth/v1/token'
265
262
}
266
263
267
- module . exports = oauthPlugin
264
+ module . exports = fp ( fastifyOauth2 , {
265
+ fastify : '4.x' ,
266
+ name : '@fastify/oauth2'
267
+ } )
268
+ module . exports . default = fastifyOauth2
269
+ module . exports . fastifyOauth2 = fastifyOauth2
0 commit comments