(ASP.Net) google oauth2 returns token after hash, not in querystring

I have a project that requires an ASP.Net application to use Google credentials, and therefore authorization is done in oauth 2.0.

I generated a valid authorization request for the Google API, but the response (and token with it) is returned after the "#" symbol. Kinda like:

[sample http link:] myredirecturi.com/oauthcallback#token=thetokenvalue ...

What I expected was in the request format, i.e. after the question mark "?":

[sample http link:] myredirecturi.com/oauthcallback?token=thetokenvalue ...

I am having problems with this: I cannot reference the token on the server-side ASP.net.

To trigger this request, basically what I am doing is doing Response.redirect for the google url, but it seems like I need a client response to it.

So my question is: how do I get google to respond to requests?

If this helps, this is what I base most of my work on: https://developers.google.com/accounts/docs/OAuth2Login

Thank.

+3
source share
1 answer

Do you set the URL of your authorization request response_type=token? This will cause the server to return the access token in the fragment. This is the client-side stream described here: https://developers.google.com/accounts/docs/OAuth2UserAgent

OAuth - ( ), -, : https://developers.google.com/accounts/docs/OAuth2WebServer - response_type=code, , .

+5

All Articles