0

I've deployed an angular project on app engine. The website is working fine, except for one issue. I use Google Authentication on this project When developping, I added loaclhost/4200 to my URI whitelist and it worked fine. but now it doesn't anymore.

After deploying, I copied the URL and added it to the whitelist URI of new credentials (as simply adding it to existing credentials didn't work, even after a day of waiting for everything to refresh). My URL looks like that: https://project-name.appspot.com/, I guess it's that one I need to had to my URI whitelist (as the error suggest and as I've done before), but I'm starting to doubt it...

Edit: It seems like the client ID provided in the error message doesn't match any of the credentials on my Google Cloud Platform project. Whitelisting the URL won't change anything, as the I'm not the owner of these credentials and I don't know where it comes from. The full error is the following:

"Not a valid origin for the client: https://myproject.appspot.com has not been whitelisted for client ID 88179289847-3n5tn140jhesoq82bcl8rdj32g6c3sms.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID." It's an error 401.

H.B.
  • 45
  • 5
  • Could you please add more details of your issue to the question? I see you are discussing an error but I couldn't find it in the description of your issue. Please could you please add any error messages or traces that could help understand your issue better? That way, we would be able not only understand better the issue, but also help other community members in case they are experiencing the same issue. Thank you – Christopher Rodriguez Conde Mar 09 '20 at 10:39
  • I will add an edit that will provide the necessary informations. – H.B. Mar 09 '20 at 13:35
  • I found some questions related that might give some light into this issue. As far as the 401 is concerned, it means you are not authorized. [Here](https://stackoverflow.com/questions/42566296/google-api-authentication-not-valid-origin-for-the-client) you could a possible solution to the solution. Also, as stated in the documentation is important to set the correct origin for your application. I would recommend taking a look at the post to see if this can solve your issue. I hope it helps. – Christopher Rodriguez Conde Mar 10 '20 at 07:54
  • I eventually figured it out: when prod building the app, I found that a client ID was added in one of the generated js files, and this client ID matched with the one provided in the error. Turns out that it belongs to a service account in my project. I don't know how it got added in the app, but building it again solved the issue. – H.B. Mar 11 '20 at 09:54

1 Answers1

0

The following error :

Not a valid origin for the client: https://myproject.appspot.com has not been whitelisted for client ID XXXXXXX-YYYYY.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID.

means you need to add your frontend URL https://myproject.appspot.com on your OAuth 2.0 Client IDs used by your application (XXXXXXX-YYYYY.apps.googleusercontent.com). Via API and Services / Credentials on Google Cloud Platform.

Add this URL or check if there isn't any typos in it.

enter image description here

Thierry Falvo
  • 4,283
  • 1
  • 14
  • 27
  • 1
    I figured out the issue, I added the "solution" in my answer to @Christopher Rodriguez Conde – H.B. Mar 11 '20 at 13:44