How to add multiple redirect URIs for Google OAuth 2?

βξhrαng picture βξhrαng · May 18, 2014 · Viewed 17.7k times · Source

I am trying to make Google OAuth 2 authentication work with a toy app I am running on my computer (at localhost:8080) using Social Auth for Java.

However when my app connects to Google to authenticate the user, Google responds with this error page:

enter image description here

My app, named "My Hobby App", is configured in the Developer Console as such:

enter image description here

In the Google OAuth 2 docs, it is specified that:

redirect_uri: One of the redirect_uri values listed for this project in the Developers Console.

Determines where the response is sent. The value of this parameter must exactly match one of the values listed for this project in the Google Developers Console (including the http or https scheme, case, and trailing '/').

I have a couple of questions:

  • How can I add multiple redirect_uris to my app?
  • Why is Google identifying my app as "Project Default Service Account" rather than "My Hobby App"?

Answer

CMPSoares picture CMPSoares · Jun 17, 2014

It's actually easier than you think, unfortunately, it took me a couple of hours to figure it out.

How can I add multiple redirect_uris to my app?

Normally when you add multiple links to something on Google or elsewhere you separate it by , or ; but with Redirect URIs you have to use a new line, it's actually not very intuitive. So when you press the Edit Settings button, you can add to the URI and/or Origins if you have a couple more links, separated by newlines (enter).

No need for complicated app configurations or new keys.

image

Why is Google identifying my app as "Project Default Service Account" rather than "My Hobby App"?

On your second question: You have to go to the "Consent Screen" tab to change your app info such as your PRODUCT NAME, HOMEPAGE, LOGO, etc.