From 14b4673edb25be4ed7cd5740528e721fb22b040e Mon Sep 17 00:00:00 2001 From: Arjun Vedak Date: Tue, 28 Jul 2020 14:58:19 +0530 Subject: [PATCH 1/5] Updated TOKEN_ISSUER to 'accounts.google.com' Hi, I was getting this issue from today morning parse-server/Adapters/Auth/google.js was expecting the TOKEN_ISSUER to be prefixed with https:// but on debugging the original value was not having the prefix, removing https:// from TOKEN_ISSUER solved this bug. This issue is introduced in 4.3.0 as in 4.2.0 it is working fine currently I have downgraded the version to 4.2.0 for it to work properly and suggesting the changes please merge this PR. --- src/Adapters/Auth/google.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adapters/Auth/google.js b/src/Adapters/Auth/google.js index 267aebb6df..65ff89e7c3 100644 --- a/src/Adapters/Auth/google.js +++ b/src/Adapters/Auth/google.js @@ -6,7 +6,7 @@ var Parse = require('parse/node').Parse; const https = require('https'); const jwt = require('jsonwebtoken'); -const TOKEN_ISSUER = 'https://accounts.google.com'; +const TOKEN_ISSUER = 'accounts.google.com'; let cache = {}; From f0aeb51158f3dea5f147acdaced328516a42f329 Mon Sep 17 00:00:00 2001 From: Arjun Vedak Date: Wed, 29 Jul 2020 11:42:02 +0530 Subject: [PATCH 2/5] Update google.js --- src/Adapters/Auth/google.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Adapters/Auth/google.js b/src/Adapters/Auth/google.js index 65ff89e7c3..e156eb1afb 100644 --- a/src/Adapters/Auth/google.js +++ b/src/Adapters/Auth/google.js @@ -7,6 +7,7 @@ const https = require('https'); const jwt = require('jsonwebtoken'); const TOKEN_ISSUER = 'accounts.google.com'; +const HTTPS_TOKEN_ISSUER = 'https://accounts.google.com'; let cache = {}; @@ -67,8 +68,8 @@ async function verifyIdToken({id_token: token, id}, {clientId}) { throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, `${message}`); } - if (jwtClaims.iss !== TOKEN_ISSUER) { - throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, `id token not issued by correct provider - expected: ${TOKEN_ISSUER} | from: ${jwtClaims.iss}`); + if (jwtClaims.iss !== TOKEN_ISSUER && jwtClaims.iss !== HTTPS_TOKEN_ISSUER) { + throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, `id token not issued by correct provider - expected: ${TOKEN_ISSUER} or ${HTTPS_TOKEN_ISSUER} | from: ${jwtClaims.iss}`); } if (jwtClaims.sub !== id) { From fb7937ae1054d572d8ee9620ae8fd2bd16f10815 Mon Sep 17 00:00:00 2001 From: Arjun Vedak Date: Wed, 29 Jul 2020 12:26:56 +0530 Subject: [PATCH 3/5] Update AuthenticationAdapters.spec.js --- spec/AuthenticationAdapters.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/AuthenticationAdapters.spec.js b/spec/AuthenticationAdapters.spec.js index 53b701f544..a42017769b 100644 --- a/spec/AuthenticationAdapters.spec.js +++ b/spec/AuthenticationAdapters.spec.js @@ -701,7 +701,7 @@ describe('google auth adapter', () => { fail(); } catch (e) { expect(e.message).toBe( - 'id token not issued by correct provider - expected: https://accounts.google.com | from: https://not.google.com' + 'id token not issued by correct provider - expected: accounts.google.com or https://accounts.google.com | from: https://not.google.com' ); } }); From 024217f8a7372aecf1b573cd967249935990a822 Mon Sep 17 00:00:00 2001 From: Arjun Vedak Date: Wed, 29 Jul 2020 13:04:54 +0530 Subject: [PATCH 4/5] Update google.js --- src/Adapters/Auth/google.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Adapters/Auth/google.js b/src/Adapters/Auth/google.js index e156eb1afb..8b7db2b169 100644 --- a/src/Adapters/Auth/google.js +++ b/src/Adapters/Auth/google.js @@ -6,6 +6,7 @@ var Parse = require('parse/node').Parse; const https = require('https'); const jwt = require('jsonwebtoken'); +// Https and without Https token issues because google sends it in multiple forms const TOKEN_ISSUER = 'accounts.google.com'; const HTTPS_TOKEN_ISSUER = 'https://accounts.google.com'; From 14d5ae9e43f9a4a4ac13ca07ab2d00eb143f58b2 Mon Sep 17 00:00:00 2001 From: Arjun Vedak Date: Wed, 29 Jul 2020 13:33:39 +0530 Subject: [PATCH 5/5] Update google.js --- src/Adapters/Auth/google.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Adapters/Auth/google.js b/src/Adapters/Auth/google.js index 8b7db2b169..e156eb1afb 100644 --- a/src/Adapters/Auth/google.js +++ b/src/Adapters/Auth/google.js @@ -6,7 +6,6 @@ var Parse = require('parse/node').Parse; const https = require('https'); const jwt = require('jsonwebtoken'); -// Https and without Https token issues because google sends it in multiple forms const TOKEN_ISSUER = 'accounts.google.com'; const HTTPS_TOKEN_ISSUER = 'https://accounts.google.com';