Skip to content

Commit

Permalink
check if query string already present. fix #172
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Murin committed Oct 15, 2024
1 parent 73b0d3f commit 3bcf224
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/webauth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ export default class WebAuth {

// Response is returned in hash, but we want to get parsed object
// Query can be parsed, therefore lets replace hash sign with '?' mark
redirectUrl = redirectUrl.replace('#','?') // replace only first one
const queryCheck = /\?.*#/;
if(queryCheck.test(redirectUrl)){
// If there is already a query string, replace hash with '&' to append to query
redirectUrl = redirectUrl.replace('#','&')
}else{
redirectUrl = redirectUrl.replace('#','?')
}
const urlHashParsed = url.parse(redirectUrl, true).query
const {
code,
Expand Down

0 comments on commit 3bcf224

Please sign in to comment.