backend-manager 2.5.24 → 2.5.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "2.5.24",
3
+ "version": "2.5.26",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -11,7 +11,8 @@ function OAuth2() {
11
11
 
12
12
  authorize: 'https://discord.com/api/oauth2/authorize',
13
13
  tokenize: 'https://discord.com/api/oauth2/token',
14
- status: ''
14
+ status: '',
15
+ removeAccess: 'https://discord.com/channels/@me',
15
16
  }
16
17
  }
17
18
 
@@ -10,7 +10,8 @@ function OAuth2() {
10
10
  authorize: 'https://accounts.google.com/o/oauth2/v2/auth',
11
11
  tokenize: 'https://oauth2.googleapis.com/token',
12
12
  // status: 'https://oauth2.googleapis.com/tokeninfo?id_token={token}'
13
- status: 'https://oauth2.googleapis.com/tokeninfo'
13
+ status: 'https://oauth2.googleapis.com/tokeninfo',
14
+ removeAccess: 'https://myaccount.google.com/security',
14
15
  }
15
16
  }
16
17
 
@@ -69,7 +69,7 @@ Module.prototype.main = function () {
69
69
  redirectUrl: payload.data.payload.redirect_uri,
70
70
  }
71
71
 
72
- assistant.log('OAuth2 payload', payload.data.payload);
72
+ assistant.log('OAuth2 payload', payload.data.payload, {environment: 'production'});
73
73
 
74
74
  if (!payload.data.payload.provider) {
75
75
  return reject(new Error(`The provider parameter is required.`));
@@ -101,6 +101,8 @@ Module.prototype.main = function () {
101
101
  newUrl.searchParams.set('response_type', typeof payload.data.payload.response_type === 'undefined' ? 'code' : payload.data.payload.response_type)
102
102
  }
103
103
 
104
+ assistant.log('OAuth2 newUrl', newUrl, {environment: 'production'});
105
+
104
106
  await self.oauth2.buildUrl(payload.data.payload.state, newUrl)
105
107
  .then(url => {
106
108
  if (url) {
@@ -212,6 +214,8 @@ Module.prototype.processState_tokenize = function (newUrl) {
212
214
 
213
215
  if (verifiedIdentity instanceof Error) {
214
216
  return reject(verifiedIdentity);
217
+ } else if (tokenizeResponse && !tokenizeResponse.refresh_token) {
218
+ return reject(new Error(`Missing "refresh_token" in response. This is likely because you disconnected your account and tried to reconnect it. Visit ${self.oauth2.urls.removeAccess} and remove our app from your account and then try again or contact us if you need help!`));
215
219
  }
216
220
 
217
221
  const storeResponse = await self.libraries.admin.firestore().doc(`users/${payload.user.auth.uid}`)