Search code examples
oauth-2.0google-oauth

Handling Multiple OAuth code query parameters


I am using 2 Oauth services in my website. They both send back a query parameter called code. And I use a custom function to grab that code field when my page loads. Do OAuth services have a way you can change that code field to be custom? I am using Google OAuth for one and I am unable to locate this.


Solution

  • No, the standard specifies that the query parameter is named code, so there's no way to name them differently.

    But the client can add a state parameter to the authorization request, which the authorization server has to return with the code. You can use that parameter to distinguish between the two authorization requests.