Question

I have been using Google Cloud Endpoints as backend for my Android app since it was only open for invitation. But now my app suddenly can't be authorized (401 error, invalide token) - so nobody of my users can sync anymore.

The code on the server ((Google App Engine) and in my Android app have not changed. So I am not sure what is going on...

The only thing I have changed is the settings in the new Developers Console https://console.developers.google.com (not the old console https://code.google.com/apis/console/). But I tested it right after and it was still working. Only some time after that agin the errors started.

This is what I changed under the settings:

1) APIs & auth -> Credentials APIs & auth

  • I added a URL to JavaScript Origins under client ID for web application (same as my Android app use), because I am working on a website that will use the API with JavaScript.

I have now removed the URL (so it is back to how it was) but I still get 401 error. Client ID and Client secret are also like before.

2) APIs & auth -> Consent screen

  • added icon and new URL to website.

Are there some compatible problems with old code and the new console? Or are the some problem with Google Cloud Endpoints now?

This is the error message I get when my Android app try to access the Google cloud endpoint.

05-13 22:17:33.726: W/GLSUser(209): GoogleAccountDataService.getToken()
05-13 22:17:37.664: W/GLSUser(209): GoogleAccountDataService.getToken()
05-13 22:17:41.667: W/GLSUser(209): [apk][apk] Permission for com.myapp to access audience:server:client_id:324234243423-sdfsdffdsagsdagsdgsadfsadf.apps.googleusercontent.com will be managed remotely.
05-13 22:17:44.011: W/System.err(8058): com.google.a.a.b.b.c: 401 Unauthorized
05-13 22:17:44.011: W/System.err(8058): {
05-13 22:17:44.011: W/System.err(8058):   "code": 401,
05-13 22:17:44.011: W/System.err(8058):   "errors": [
05-13 22:17:44.011: W/System.err(8058):     {
05-13 22:17:44.011: W/System.err(8058):       "domain": "global",
05-13 22:17:44.011: W/System.err(8058):       "location": "Authorization",
05-13 22:17:44.011: W/System.err(8058):       "locationType": "header",
05-13 22:17:44.011: W/System.err(8058):       "message": "Invalid token.",
05-13 22:17:44.011: W/System.err(8058):       "reason": "required"
05-13 22:17:44.011: W/System.err(8058):     }
05-13 22:17:44.011: W/System.err(8058):   ],
05-13 22:17:44.011: W/System.err(8058):   "message": "Invalid token."
05-13 22:17:44.011: W/System.err(8058): }

Thanks :)

Was it helpful?

Solution

Ok, it is working again now. Google have fixed the bug in Google App Engine that caused the problem. See this post for more details:

Google App Engine suddenly started failing endpoints authentications

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top