I am developping a google chrome extension in which I need to authenticate the user on Twitch. According to https://github.com/justintv/Twitch-API/blob/master/authentication.md, I registered an application to get a client_id and my chrome extension open the following link:
https://api.twitch.tv/kraken/oauth2/authorize
?response_type=token
&client_id=[your client ID]
&redirect_uri=[your registered redirect URI]
&scope=[space separated list of scopes]
After accepting to use my application, users are redirected to this link:
https://[your registered redirect URI]/#access_token=[an access token]&scope=[authorized scopes]
[your registered redirect URI] is the link of my node js server. I need to save the access_token information, but I don't know how to access to elements after '#'. The request url or its params aren't containing them.
There is already an explanation in the documentation just below the line that you 've posted:
Note that the access token is in the URL fragment, not the query string, so it won't show up in HTTP requests to your server. URL fragments can be accessed from JavaScript with document.location.hash
The browser/client removes the fragment elements before sending the request to the server. You have to load the page, have a small javascript script and retrieve the values from the client. Then you can decide how to handle the data. For example, you can fire an ajax request to your server.