Page Summary
-
API Key authentication issues can be resolved by enabling the ARCore API, checking for and disabling API Key restrictions, and ensuring the API Key in your project's credentials matches the one used by your app.
(Android) Keyless doesn't work (ErrorNotAuthorized)
When communication with the ARCore API server throws ErrorNotAuthorized, ensure that your application contains the
com.google.android.gms:play-services-auth library:
- Build your app, and check the resulting artifact with the APK
Analyzer. Ensure
that the built application binary includes the
com.google.android.gms.authpackage, and that its contents are not renamed or minified.- If it is not present, follow Include required libraries and ensure the library is included and that the minification settings are correct.
Show the security information present in the failing target artifact using the
keytoolutility:AAB artifact
keytool -printcert -jarfile artifact.aab
APK artifact
keytool -printcert -jarfile artifact.apk
Ensure the SHA-1 certificate fingerprint matches the credentials used in your project's OAuth 2.0 client ID.
Ensure that you have enabled the ARCore API for the correct project in Google Cloud.
(Android) Keyless authorization is successful in some build types (e.g. Debug) but not in others
If keyless authorization succeeds in certain builds but not in others, ensure that the fingerprint present in the failing artifact matches the fingerprint listed in the Google Cloud Console. See Keyless authorization doesn't work and follow steps to verify that the signing key fingerprint for that artifact matches the fingerprint listed in Google Cloud.
(Android) Keyless authorization does not work when using Play App Signing
If keyless authorization works on your local builds, but not after uploading to the Google Play Store when Play App Signing is enabled, ensure that the SHA-1 certificate fingerprint registered in your project's credentials match the fingerprint Google uses to sign your app:
- In the App Signing page in Google Play, scroll to App signing key certificate. Note the SHA-1 certificate fingerprint.
- Create a new OAuth 2.0 client ID using the SHA-1 certificate fingerprint from the previous step.
For more information, see Play App Signing.
(iOS) Keyless authorization doesn't work (ErrorNotAuthorized)
Check ARCore API settings
Ensure that the ARCore API is enabled.
Check the service account keyfile
Open the json keyfile used to sign your tokens.
- Verify that the
project_idfield is the same Project ID in Google Cloud. - Verify that the
client_emailfield matches the email address listed in your Service Account.
Check the generated tokens
Obtain a signed token and paste it into a JWT debugger to verify the payload:
- Ensure that the
audclaim ishttps://arcore.googleapis.com/. - Ensure that the
issandsubclaims are equal to theclient_emailfield in your keyfile, and match the Service Account. - Ensure that the
exptimestamp is in the future.
API Key authentication is not working
If API Key authorization is not working, follow these steps:
- Ensure that you have enabled the ARCore API for the correct project in Google Cloud.
- If you have any API Key restrictions enabled, temporarily disable them.
- Ensure that the API Key listed in your project's Credentials exactly matches the API Key used by your app, with no spaces or any other characters.