Access Not Configured Error when connecting to Google Play Serives - java

I am getting the following error when attempting to connect to Google Play Services:
-- E/Volley﹕ [131] BasicNetwork.performRequest: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/me?language=en_US
-- E/SignInIntentService﹕ Access Not Configured. Google Play Game Services API has not been used in project 608941808256 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/games/overview?project=608941808256 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
com.google.android.gms.games.server.error.GamesException
I have configured my application on Google Play Developer Console and it's ready for testing. I have linked an app to it and enabled appropriate APIs in the Developer Console (Google+ Api, Google Play Services Api, Goole Play Android Developer Api ..).
I used the SHA1 keys that the apk uses, which I added to the OAuth 2.0 list in the Developer Console.
I am using sample code provided by Google, have added my app_id in the ids.xml file (1058015326796), which does not match the project ID in the error message.
How do I connect to Google Play Services properly? Have I forgot some step in setting up the access? Why is the project ID in the error message different from the ID I am using in the application?

608941808256 is a telling project ID - it means that for some reason Google Play services didn't map your app to your client ID. This look up is generally performed by SHA1 and package name.
You mention you added your SHA1 to the developer console, which is good - maybe then check that the package name is correct. For example, maybe you append ".dev" to the package name for development builds or similar, or the package name in your build.gradle is different than the one in the Developer Console.
Remember to look under OAuth 2.0 client IDs as well - that's the section that needs to have matching values.

I spend 4 days with the same problem.
I had created project in Google Play Developer Console with all needed API's
Like you I used the SHA1 keys that the apk uses, which I added to the OAuth 2.0 list in the Developer Console.
And the solution in my case was :
to generate signed APK.
I was sending GET request for Account Data with app that was just build and run.
After 4 days of trying i read
Before you can publish an app that retrieves an OAuth 2.0 token for Google REST APIs, you must register your Android app with the Google Cloud Console by providing your app's package name and the SHA1 fingerprint of the keystore with which you sign your release APK.
and thought I will generate signed APK, and it worked.
Ps. I doesn't use Volley so i don't know if this will help you.

I got the same error.
[Problem 1] Wrong app_id, achievement/leaderboard IDs in the ids.xml!
[Solution 1] Replace or set the ids from google play game console.
[Problem 2] Use debug key and release key by mistake
[Solution 2] Be careful using the key(SHA1), pay attention whether it is debug or release.

Related

Android Error when communicating with the Firebase Installations server API

I am getting an Error Message on App Startup Stating Logs like
W/Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: {
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console",
"url": "https://console.developers.google.com"
}
]
}
]
}
}
]
2020-04-27 12:42:34.621 22226-23596/in.co.androidapp.g7 E/Firebase-Installations: Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.
I got an email about a week earlier that I should update my google_services.json File, which I have done 4-5 times. No Improvements. It had been working fine for around a year. Its been only 2-3 days since I am facing this issue in the app.
Subsequently, Firebase Cloud Messaging and other firebase services are not working. I am not doing programmatic initialization (that is, using a FirebaseOptions object to provide these values), just the default initialization using FirebaseApp.initializeApp(this);
I have tried https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md
Thanks in Advance.
I had this same issue. I solved it by the following way.
go to app/build/generated/res/google-services/debug/values/values.xml
Here you can find your old API key.
Replace both google_api_key and google_crash_reporting_api_key values with the new one that you can find from the google-services.json file. it will be under api-key array.
Cheers!
If you have issues with your API key, you can create a new API key in the Cloud Console:
go to the Google Cloud Console
choose the relevant project (i.e. the project you use for your application)
open the menu and go to APIs & Services → Credentials
on top of the page click on + CREATE CREDENTIALS → API key
replace the API key in your application with the newly created API key
In case you are using the google-services.json config file from your Firebase Console, you first have to delete or restrict the API key used in your current google-services.json in order to make Firebase update config file and use a new API key.
Identify the API key in your google-services.json config file.
Confirm that the API key is creating the erroneous requests by checking its usage against the Firebase Installations API metrics page. The column Usage with this service of your API key should show a number greater than 0.
Delete that API key by clicking the bin symbol or add Application restrictions to that API key by clicking the pencil symbol. !!Warning!! Do not delete an API key that existing installations of your applications require for other Firebase services like Firebase Auth or Realtime-Database.
Wait a couple of minutes for Google servers to update. The next download of your google-service.json config file should contain a new API key.
You can test your configuration with the following CURL command.
What is the error you are getting?
(Note: If you are seeing JSON data the request was and your configuration is successful)
Test if your configuration works with the following CURL command:
api_key=<YOUR_API_KEY>;
project_identifier=<YOUR_PROJECT_ID>;
app_id=<YOUR_FIREBASE_APP_ID_EXAMPLE_1:12345678:android:00000aaaaaaaa>;
curl -H "content-type: application/json" -d "{appId: '$app_id', sdkVersion: 't:1'}" https://firebaseinstallations.googleapis.com/v1/projects/$project_identifier/installations/?key=$api_key;
Other relevant links regarding API keys and the Firebase Installations API:
https://firebase.google.com/support/privacy/init-options
https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md
https://firebase.google.com/support/release-notes/android#2020-02-27
https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/REQUIRED_FIREBASE_OPTIONS_ANDROID.md
Late but might be helpful to others.
I tried everthing here, at last I got it working by making sure following steps,
Rule: App's SHA-1 should be registerd in Google Developer Console with the API keys used.
Look for the SHA-1 you are using (debug or release). You can do it by going to android studio > Gradle form side bar > Tasks > android > signingReport. Double click on it to run. Once it runs, you will be able to find out SHA-1 for your variant. (In my case, I was trying to make it run for release variant). Keep that SHA-1 aside we will check for its existance on Google Developers Console.
Now head over to https://console.cloud.google.com/apis/credentials, In your selected project > Credentials, Find API key that is used, Click on it to go into details, Find Restrict usage to your Android apps, see if the SHA-1 is registed there along with your package name.
If you do not find the same SHA-1 that you had in your project, then you can click on Add an Item to add the app. Pass package name and SHA-1 and submit.
Try again to connect firebase APIs after 5-10 mins.
I encountered with this error when initializing new app so it may not solve your issue since you say your app is existing but I hope it helps.
I've created new SHA Key for SHA-1 fingerprint of keystore certificate (both for debug and signing! only signing didn't work)
and I've added them into my firebase settings (below my package name careful if you have multiple). Now it works for me.
It turned out that the issue was with the version of firebase-messaging for me, using this version in app gradle got rid of the error:
implementation "com.google.firebase:firebase-messaging:20.1.0"
This error could happen if you include in gradle some firebase modules that not configured properly (analytics, storage, messaging etc.)
I encountered the same issue, click on the link provided:
"links": [
{
"description": "Google developers console",
"url": "https://console.developers.google.com"
}
From there on, Go to the 'credentials' menu.
Confirm in your google-services.json file the API key being used.
Go back to the google portal and look for that key under API keys.
Once you find it, click to edit and when editing, add your project's package name and SHA-1 certificate key.
Save and wait for 5 mins, the error should be gone.
I had the same issue. Please find the following steps i followed to resolve this.
Navigate to the google project and make sure your app sha1 key is configured properly.
Download the google-services.json file from the project and make sure it is same as the one exists in the android project
Clean the project to remove all build configurations generated previously.
Build the app
Just Register your app in the Firebase console again.
and get the googl-service.json file and replace it with old. it will be solve
If you have changed your API Key on https://console.cloud.google.com or you have restricted it you gotta follow these steps:
Make sure that your new key is into google-service.json(download from firebase console).
Open the google-service.json, find api_keys and leave just the current_key that belongs to every environment(dev or prod).
Go to project/app and delete the folder build.
To fix this error read this file using CMD or Windows Explorer
PS C:\Users\Any> keytool -keystore C:\Users\Any\.android\debug.keystore -list -v
Enter keystore password:
Use 'KeyStore Explorer' from https://keystore-explorer.org/downloads.html
& paste it here:
https://console.developers.google.com/apis/credentials/key/
If you are facing this issue in the Flutter app then go to your project directory and delete the build folder. Hopefully, it will work.
Here's what made that error go away for my app:
I deleted the Project .gradle folder, the Project build folder and the app build folder, all at once. I then re-installed the app, and no more Firebase Installations server API error!
Inside Google API's & Service Credentials > Android key (auto created by Firebase) > API Restrictions
Select All services and save. After 5-10 minute you can check.
This is mainly happened by your outdated google-services.json file. because sometime you may enable some extra services in firebase has changed the entire structure of that file. so go to your firebase console -> project settings -> download google-services.json and replace it
then rebuild your app. Now you check your firebase has error
I had this issue in Iran. after running a VPN my app was connected to firebase.
This problem face me and I fixed by go to Google cloud platform and credentials and do API for firebase with Application restrictions or API restrictions as you used.jhvghvj

Using two Google APIs with the same application

I have an application which connects to Google Drive API.
Now I have to add another function which requires the Google Directory API.
I granted the necessary permissions and enabled the new API in my project.
However I'm still getting this error:
"message" : "Access Not Configured. Admin Directory API has not been
used in project 594418282793 before or it is disabled. Enable it by
visiting
https://console.developers.google.com/apis/api/admin.googleapis.com/overview?project=594418282793
then retry. If you enabled this API recently, wait a few minutes for
the action to propagate to our systems and retry."
The problem is that the URL in the message gives me an error; apparently the project ID is invalid.
This is the error:
There was an error while loading
/apis/dashboard?project=594418282793. You are missing at least one of
the following required permissions:
Project
resourcemanager.projects.get
Check that the project ID is valid and you have permissions to access
it.
I have no idea what is the cause of this mismatch, why the project ID provided in the error message doesn't seem to exist, and where else should I enable the second API in my application.
Any ideas would be much appreciated.
I think you have miss understood how the credentials.json works.
Access Not Configured.
Means that the credentials you have loaded for this client has not been setup for the api you are trying to connect to.
When you create a project on Google developer console this is to give google information about your application as a whole and what it is designed to do. You should enable both apis in the single project.
Once that is done create your Oauth credentials as you did before this credential file will then be able to connect to both apis .
googel developer console
Left hand menu click credentials then button on the top says create credentials
Once you have created it click the arrow to download you can download the file anytime

Sign in Configuration Issue in release version of App

I have this app which uses Google Services json file configured with a SHA1 of a debug key, and then build the Signed Build with a new key and used that release.apk to install the app. But the sign in part isn't working now in the release version of the app.
So now my question is, should the Google services json file be configured using the SHA1 of the signed key?? Ignore the formatting since I'm using this from mobile.
Based on the document: Setting Up Google Play Games Services
Specify client ID settings
You should create two client IDs, one with the release certificate fingerprint and another with the debug certificate fingerprint. Make sure to use the same package name for both. This allows Google Play games services to recognize calls from your linked APKs that are signed with either certificate. For more information about certificate signing for Android, see Signing Your Application.
Check this SO post, it talked about the difference of the clientID for debug and release version. Lastly, check the documents : Prepare for Release and Sign Your App for a detailed instruction of preparing your app for release.

Using google oAuth2 to collect gmail email from java app

I have a web base email client that uses a java app to connect to IMAP and POP3 servers to download email. There is an issue that if a user usually logs in form the US that the java app will not have access to collect emails until that user logs in from the same county the java app is running.
I was told to overcome this to use google oAuth in order for the account user to give permission to my app to collect emails. Is this correct? Once this has been accomplished I would also like to the the API to import contacts, but for now authorization/authentication is sufficient.
The problem I am facing is that after trying to make heads a or tails of the google oAuth api documentation im really confused and did not yet manage to make a working example. Documentation often has links to a depreciated API and there is no example with a dowload link to both the API needed and exaple source code, as a result I think im using incorrect libraries for my examples.
Its also not clear to me what/how to accomplish what is needed do I use client authentication via javascript to create a popup whereby the user grants access?
Or do I use installed app client with a token and secret, this is what I tried but the 'command line' example I tried requires Java EE and this is a native app so I dont see why and I dont want to import all Java EE libraries to my small email downloader app.
Where can I find more intuitive documentation and working examples on this?
If you stay away from OpenID 2 and OAuth 1, I think the docs are pretty orderly these days. The best place to start is https://developers.google.com/accounts/docs/OAuth2

Android + Google App Engine connection

I'm working on connecting an android app in Java with google app engine. This is my first time doing it. I watched and did the same thing that it was done in this video:
http://www.youtube.com/watch?v=M7SxNNC429U
I have been working and I'm getting the same problem. When creating the project and running it, it runs but it shows me a message that I have to create/add an account, I already register it when creating the project. When I enter my gmail account info it shows me a message saying: "Can not connect with the server". I'm not sure what it is happening, please a ed help on it, thanks for you time and patience.
Careful C2DM is deprecated in favor of Google Cloud Messaging and the latest Google plugin doesn't have the wizard for creating a App engine connected android project
That video is awesome, but there's some useful documentation for AppEngine Connected Android apps too. Specifically in the Creating A New Project section, it explicitly states,
Important: You must sign up for a C2DM account using the same Google account that you use for the Android application you are developing and for the GPE plugin.
You can go back and edit things later so that the account you're logging into the app with is separate from the role account being used for C2DM. But for the code generated by the plugin, they have to be the same account. Also, don't forget you actually have to sign up for C2DM, as it isn't enabled in all accounts by default.

Categories

Resources