Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Support URL with Hash based routing #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/CognitoAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down