In my app I'm using the Google Drive API but I'm getting the following message when the app is installed via Google Play:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code": 403,
"errors": [
{
"domain": "usageLimits",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"reason": "dailyLimitExceededUnreg",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
at d.f.b.a.b.d.a.b.newExceptionOnError(AbstractGoogleJsonClientRequest.java:2)
at d.f.b.a.b.d.a.b.newExceptionOnError(AbstractGoogleJsonClientRequest.java:1)
at d.f.b.a.b.d.b.a(AbstractGoogleClientRequest.java:5)
at d.f.b.a.c.p.a(HttpRequest.java:88)
at d.f.b.a.b.d.c.executeUnparsed(AbstractGoogleClientRequest.java:3)
at d.f.b.a.b.d.c.executeUnparsed(AbstractGoogleClientRequest.java:1)
at d.f.b.a.b.d.c.execute(AbstractGoogleClientRequest.java:1)
My code follows the example from Google:
final GoogleAccountCredential credential =
GoogleAccountCredential.usingOAuth2(
this, Collections.singleton(DriveScopes.DRIVE_FILE));
credential.setSelectedAccount(googleAccount.getAccount());
final Drive googleDriveService =
new Drive.Builder(
AndroidHttp.newCompatibleTransport(),
new GsonFactory(),
credential)
.setApplicationName(getString(R.string.app_name))
.build();
mDriveServiceHelper = new DriveServiceHelper(googleDriveService);
mDriveServiceHelper.queryFiles()
.addOnSuccessListener(fileList -> {
// Logic to load the data
})
.addOnFailureListener(exception -> {
Log.e(TAG, "Unable to query files.", exception);
// This is where it fails
});
I'm able to Sign In the user but then when trying to retrieve the files, it fails with the reason dailyLimitExceededUnreg.
I've looked at several examples such as:
- Google Drive Api stops working after publishing app
- Google sign in not working after publishing in play store
- Google Sign In Service not working after publish on PlayStore
I've created OAuth Tokens with the App Signing Certificate from Google Play and the SHA1 is also included in Firebase, which I've included in the project. I've created also new API Keys, the application hasn't exceeded the daily limit.
The app works locally successfully, I'm assuming due the to the debug certificate, but not sure why it is not working when downloading from Google Play.
Any suggestions?