generic-oauth2
generic-oauth2 copied to clipboard
Parse URL Parameters Properly
Currently, URL fragments are being treated as a part of the query string. These are two distinct pieces of a URL, and should be handled separately. This PR updates the logic within WebUtils.getUrlParams() to:
- Parse the
urlStringusing the Javascript URL interface. This interface properly separates the query string and fragment - If the URL doesn't contain a query string or a fragment, return undefined
- If the URL contains a query string, parse its values, otherwise parse the fragment
This resolves #182
The example facebook Web flow also currently fails due to the returned response not being parsed correctly.
The Url from the provider/facebook is returned as:
http://localhost:3000/login?#access_token=...
Which then gets parsed as
{
"#access_token": "..."
}
Which then thows ERR_NO_ACCESS_TOKEN as it doesn't expect to find the hash
Thanks for this PR