Saturday, July 2, 2016

GoogleAuthException: INVALID_AUDIENCE

I've been having some problems getting an Android app to properly authenticate with my app engine backend. For like weeks, spending the evenings looking through every single google result and trying out different combinations of peoples experience. Today, I finally figured out what my mistake was and I have to write this down.

The problem lies on this page and in this statement.
You need to specify your Android app's package name and SHA1 fingerprint.
  1. In the Package name field, enter your Android app's package name.

This is WRONG! It is in fact the applicationId in the build.gradle file that should be used. The package name in the manifest and the applicationId is most of the time the same, but in my it was not. And I never got the app to properly authenticate. But now it does and I'm happy again!