From ca21cadba369a3672187a784ce3b055ab5c8da84 Mon Sep 17 00:00:00 2001 From: bpackter Date: Tue, 9 Oct 2018 21:58:54 +0300 Subject: [PATCH] add another parameter for `parseCognitoWebResponse` this should support URL with hash based routing, the has isn't stands for query params and shouldn't be parsed --- src/CognitoAuth.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CognitoAuth.js b/src/CognitoAuth.js index c1437b8..00c7369 100755 --- a/src/CognitoAuth.js +++ b/src/CognitoAuth.js @@ -259,12 +259,13 @@ /** * @param {string} httpRequestResponse the http request response + * @param {boolean} isHashBasedUrl true if the url is made with hash routing * @returns {void} * Parse the http request response and proceed according to different response types. */ - parseCognitoWebResponse(httpRequestResponse) { + parseCognitoWebResponse(httpRequestResponse,isHashBasedUrl) { let map; - if (httpRequestResponse.indexOf(this.getCognitoConstants().QUESTIONMARK) > -1) { // for code type + if (isHashBasedUrl || httpRequestResponse.indexOf(this.getCognitoConstants().QUESTIONMARK) > -1) { // for code type // this is to avoid a bug exists when sign in with Google or facebook // Sometimes the code will contain a poundsign in the end which breaks the parsing const response = (httpRequestResponse.split(this.getCognitoConstants().POUNDSIGN))[0];