Reputation: 1214
Is it possible to pass a parameter to web page via the OAuth redirect URL once the user authenticates? I have specified a parameter on the redirect URL in the Google credentials configuration page but it is not being passed. I'd like to get the value of foo below:
https://example.com/Test?foo=1234
Upvotes: 1
Views: 6343
Reputation: 2048
I'm guessing you want to use the query parameter to encode some sort of information that will track the OAuth flow on your end. In that case, you would need to use the state parameter. You will get the state parameter back as a parameter to your redirect_uri
More information:
https://developers.google.com/identity/protocols/OpenIDConnect#sendauthrequest
https://developers.google.com/identity/protocols/OpenIDConnect#state-param
The state can be useful for correlating requests and responses. Because your redirect_uri can be guessed, using a state value can increase your assurance that an incoming connection is the result of an authentication request. If you generate a random string or encode the hash of some client state (e.g., a cookie) in this state variable, you can validate the response to additionally ensure that the request and response originated in the same browser. This provides protection against attacks such as cross-site request forgery.
Upvotes: 5