I have an Android client getting an authentication token from Google Play Services, by using GoogleAuthUtil.getToken(Context context, Account account, String scope)
.
This is then sent to a backend (Go) server, which checks that the token was signed by one of the Google signing certificates from https://www.googleapis.com/oauth2/v1/cert. To do this, it needs to look up the certificate assigned to the "kid" in the token header.
99% of the time, this works just fine, but I have regular situations where the "kid" given does not correspond to any published Google certificates, and so I can't auth the token.
Edit:
I've added extensive logging on the server to try and track this down, and there are some relationships worth noting:
- Any given invalid
kid
is only used for a single user. I often see multiple requests over several days from the same user with a given invalidkid
, but only ever from that user. - A user giving an invalid
kid
never uses a validkid
for any request, or any otherkid
for a request, even if they are days apart. Afaik Google cycles their certificates every 24 hours or so. - Many users are using older client versions. Most users upgrade within a day or two of a new version being released, but the majority of users with invalid certificate keys use versions that are a few weeks old.
- The requests come from an even spread around the globe in line with our user base.
- The requests come from a spread of times, in line with our user base.
- The requests come from a range of devices, manufacturers, and models.
My current thoughts are that it's probably from users who have downloaded the APK from a site other than Google Play, but I have no way of verifying this right now.
Edit: There is an issue tracker for this, but it seems that it has been marked as a low priority. If anyone has this issue, please let it be know on the tracker. https://issuetracker.google.com/issues/37734997