|
@@ -1,6 +1,4 @@
|
|
const google = {
|
|
const google = {
|
|
- transport: 'session',
|
|
|
|
-
|
|
|
|
// access_type: offline is needed in order to get refresh tokens.
|
|
// access_type: offline is needed in order to get refresh tokens.
|
|
// prompt: 'consent' is needed because sometimes a user will get stuck in an authenticated state where we will
|
|
// prompt: 'consent' is needed because sometimes a user will get stuck in an authenticated state where we will
|
|
// receive no refresh tokens from them. This seems to be happen when running on different subdomains.
|
|
// receive no refresh tokens from them. This seems to be happen when running on different subdomains.
|
|
@@ -15,51 +13,59 @@ const google = {
|
|
"scope_delimiter": " "
|
|
"scope_delimiter": " "
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const defaults = {
|
|
|
|
+ transport: 'session',
|
|
|
|
+ state: true, // Enable CSRF check
|
|
|
|
+};
|
|
|
|
+
|
|
// oauth configuration for provider services that are used.
|
|
// oauth configuration for provider services that are used.
|
|
module.exports = () => {
|
|
module.exports = () => {
|
|
return {
|
|
return {
|
|
// we need separate auth providers because scopes are different,
|
|
// we need separate auth providers because scopes are different,
|
|
// and because it would be a too big rewrite to allow reuse of the same provider.
|
|
// and because it would be a too big rewrite to allow reuse of the same provider.
|
|
googledrive: {
|
|
googledrive: {
|
|
|
|
+ ...defaults,
|
|
...google,
|
|
...google,
|
|
|
|
+ state: true,
|
|
callback: '/drive/callback',
|
|
callback: '/drive/callback',
|
|
scope: ['https://www.googleapis.com/auth/drive.readonly'],
|
|
scope: ['https://www.googleapis.com/auth/drive.readonly'],
|
|
},
|
|
},
|
|
googlephotos: {
|
|
googlephotos: {
|
|
|
|
+ ...defaults,
|
|
...google,
|
|
...google,
|
|
callback: '/googlephotos/callback',
|
|
callback: '/googlephotos/callback',
|
|
scope: ['https://www.googleapis.com/auth/photoslibrary.readonly', 'https://www.googleapis.com/auth/userinfo.email'], // if name is needed, then add https://www.googleapis.com/auth/userinfo.profile too
|
|
scope: ['https://www.googleapis.com/auth/photoslibrary.readonly', 'https://www.googleapis.com/auth/userinfo.email'], // if name is needed, then add https://www.googleapis.com/auth/userinfo.profile too
|
|
},
|
|
},
|
|
dropbox: {
|
|
dropbox: {
|
|
- transport: 'session',
|
|
|
|
|
|
+ ...defaults,
|
|
authorize_url: 'https://www.dropbox.com/oauth2/authorize',
|
|
authorize_url: 'https://www.dropbox.com/oauth2/authorize',
|
|
access_url: 'https://api.dropbox.com/oauth2/token',
|
|
access_url: 'https://api.dropbox.com/oauth2/token',
|
|
callback: '/dropbox/callback',
|
|
callback: '/dropbox/callback',
|
|
custom_params: { token_access_type : 'offline' },
|
|
custom_params: { token_access_type : 'offline' },
|
|
},
|
|
},
|
|
box: {
|
|
box: {
|
|
- transport: 'session',
|
|
|
|
|
|
+ ...defaults,
|
|
authorize_url: 'https://account.box.com/api/oauth2/authorize',
|
|
authorize_url: 'https://account.box.com/api/oauth2/authorize',
|
|
access_url: 'https://api.box.com/oauth2/token',
|
|
access_url: 'https://api.box.com/oauth2/token',
|
|
callback: '/box/callback',
|
|
callback: '/box/callback',
|
|
},
|
|
},
|
|
instagram: {
|
|
instagram: {
|
|
- transport: 'session',
|
|
|
|
|
|
+ ...defaults,
|
|
callback: '/instagram/callback',
|
|
callback: '/instagram/callback',
|
|
},
|
|
},
|
|
facebook: {
|
|
facebook: {
|
|
- transport: 'session',
|
|
|
|
|
|
+ ...defaults,
|
|
scope: ['email', 'user_photos'],
|
|
scope: ['email', 'user_photos'],
|
|
callback: '/facebook/callback',
|
|
callback: '/facebook/callback',
|
|
},
|
|
},
|
|
// for onedrive
|
|
// for onedrive
|
|
microsoft: {
|
|
microsoft: {
|
|
- transport: 'session',
|
|
|
|
|
|
+ ...defaults,
|
|
scope: ['files.read.all', 'offline_access', 'User.Read'],
|
|
scope: ['files.read.all', 'offline_access', 'User.Read'],
|
|
callback: '/onedrive/callback',
|
|
callback: '/onedrive/callback',
|
|
},
|
|
},
|
|
zoom: {
|
|
zoom: {
|
|
- transport: 'session',
|
|
|
|
|
|
+ ...defaults,
|
|
authorize_url: 'https://zoom.us/oauth/authorize',
|
|
authorize_url: 'https://zoom.us/oauth/authorize',
|
|
access_url: 'https://zoom.us/oauth/token',
|
|
access_url: 'https://zoom.us/oauth/token',
|
|
callback: '/zoom/callback',
|
|
callback: '/zoom/callback',
|