Last Updated: February 25, 2016
·
376
· troylelandshields

Why won't the OAuth 2.0 dance work with Angular and Google Cloud Endpoints?!?

We were getting very frustrated with trying to figure out why Angular and Google and OAuth 2.0 weren't playing nice with each other.

The idea is that you ask the OAuth 2.0 library for a user, which it returns to your browser. Then, when you use your client library to access your Google Cloud Endpoints library, any API method that accepts a User object magically has one supplied.

In our case, the user was being returned from the OAuth library and was accessible to the browser, but for some reason it always came to the Google Cloud Endpoints API as null. This was extremely frustrating, but when we finally figured out the reason it was a simple fix:

Don't set a Redirect URI on your Web Application Client ID