I have followed the HelloEndpoints tutorial by Google where I've implemented the backend API in Java and an Android client, where I'm getting this error from. https://cloud.google.com/appengine/docs/java/endpoints/getstarted/clients/android/
I've deployed the Android app client on a physical device. When I launch the app and touch the "Sign in" button, a dialog is shown since I have two Google accounts on the phone. I choose one and then the correct email address is shown for a couple of seconds in the label before it disappears. Then I'm getting the authentication error.
Several suggested solutions are mentioned at Stackoverflow and other sites , but nothing I've tried so far has helped.
I have tried to:
Kind regards, Ramon
I finally solved the problem yesterday :)
On Google Developer Console, I realized that I had an Android key for Public API access, but no Android Client ID for OAuth. The only Client ID I had for OAuth was for web applications.
After I've created one for Android apps, the authentication exception were gone.
Thereafter I got another exception when I tried to invoke the method requiring the authentication. When I checked the log on Google Developer Console, the invocation wasn't even logged! Which made me think that the invocation of the method isn't correct.
When I tried to invoke the method from the web it worked. I then checked my terminal and there I saw the [email protected] mail address. So, the invocation from the Android client was sent to my local devserver even though I had the web service deployed (and the servers ip-address wasn't set in the Android code). My next step was to shutdown the local devserver and then I re-deployed the backend API before I tested the Android client again.
Finally after these two changes I can invoke the authenticated method and get a correct response :)