A quick solution to fix this is, assuming your redirect URI is http://localhost:8000/#/callback
, to add a Route to your HashRouter with a regex:
<Route path="/:access_token(access_token=.*)" component={ComponentWhichParsesTheURLAndExtractTheToken} />
This will direct any url of the type http://localhost:8000/#/access_token=
to the desired component. The desired component should be the one where you parse the url to capture the token.
If you use the Spotify function getHashParams()
from their implicit grant example to capture the hash params also change this line :
q = window.location.hash.substring(1);
to
q = window.location.hash.substring(2);
in order to remove the first character /
from the window.location.hash
path.
There is probably a better solution (see this answer for angular) for this problem, although I figured this is a quick hack that works for modest applications.