Google GMail API Access Not Configured Via Android App - android

I am trying to follow
https://developers.google.com/gmail/api/quickstart/android
To get talking to the GMail API for Google Play.
I have created my project, my credential using the SHA1 from my debug.keystore file. I have double checked the package name is correctly matching. I have verified that Android studio is signing w/ the debug.keystore. I am still getting Access Not Configured when trying to run the example code. Does anyone have any ideas?

I guess, if you have ended up following the documentation, the issue could be:
The build.gradle file in the app module, there, the package name would should point to a different one and not yours. Cross check.
Also try adding couple of other APIs as well, like Contacts and Google+ APIs in console.
It is working for me!

Related

getToken() failed. Status BAD_AUTHENTICATION error

I've found the following error when running my android application in android studio. app couldn't get installed on my device because of this error. Didn't find the solution :(
please help
Auth: [GoogleAccountDataServiceImpl] getToken() failed.
Status BAD_AUTHENTICATION,
Account: ,
App:com.android.vending,
Service: androidmarket com.google.android.gms.auth.be.account.b.d: Long live credential not
available.
I had the same issue what helped me was that I had wrong credentials in my google-services.json file and after getting a new file my problem was fixed.
in the process of resolving this issue I also updated my google play services but I do not think this is necessary .
I got this error when tried to install app directly from Android Studio.
It was due to certificate mismatch, since I used release certificate for setting up the app in Play Console, while Android Studio signs the app with debug certificate by default.
Installing app via adb resolved the error.
https://developers.google.com/games/services/android/quickstart#step_4_test_your_game
Make sure to run an APK that you exported and signed with a
certificate that matches one of the certificates you used during the
application setup in Google Play Console.
I have the same problem some days ago. I just compile my whole code in a new project and Problem Solved!!.
Don't know what was the real problem. There is an issue filed here, with no solution.
There are several reasons you can get that message:
The account you are trying to log on with needs to be re-authenticated on the phone (try a different account)
The gms:play-services version is out of date (needs to be 15+ as of Jan 2021)
Your app fingerprint is not the right one. You need one for dev builds, different one for prod -- which is different based on how you sign (do you have the final publish key, or does Play store re-sign with the final publish key?)
Follow the Google tutorial and get their stand-alone project, it should take 20 min, and check your setup there. If you are running it with all the right accounts it should work. Then go back to your app.
https://developers.google.com/identity/sign-in/android/start
I updated Google Play Services on my phone and stopped receiving the same error. I am importing com.google.android.gms:play-services-cast:9.6.1 and analytics:9.6.1. Not sure if the version running on the device was too low but problem is now resolved but not sure how to prevent this error for users running older versions of Google Play Services.
Tested the other solutions but nothing worked. Rebooted the device and error was gone.
If you using firebase server, As per the firebase updation if you give phone number authentication put your country code before contact number it is mendetory.
example - +91 9999998888
This happened to me, auth errors in ADB, among them:
android Warn Auth [GoogleAuthUtil] GoogleAuthUtil
Because, like mentioned above, I had a debug build running on phone previously. So I fully uninstalled the app on my phone, and the next [Build and Run] ran successfully.
Please try the App with new google credentials or even try creating the whole peoject on console og google play services if you have used it .
In my case it was a dependency version problem. I had to update the auth dependency for firebase to the latest one:
implementation 'com.google.firebase:firebase-auth:17.0.0'
Here is my take towards this problem:
You may be using a single email to try and log in to google. It may be possible you might have changed the password of the particular email in the recent past. Make sure u remove your google-email from your phone/emulator. When u re-run your application, you will be asked to enter both email and password credentials.
Check if your credentials.json is still valid. Sometimes its possible that your client ID might be removed/corrupted if you have not used your android application for a long time. Make a new one and dont forget to copy-paste it in app folder of Android Project view.
PS: I am new to Android Studio and writing answers on stackoverflow in general. If you are reading this comment please let me know what improvements i can make while answering questions in the future.
I copied and ran the code in a different project that had priorly worked on simple DB operations of Firebase. Probably it already had the authentication files in place so launching the app was solved there
Mostly your token has gone bad. And needs a new one.
Go to project database > settings > General > download Json file and replace it with the one in the local project directory.
I fixed this problem with updating fingerprints (sha1 or sha256)
My problem was with Microsoft App Center.
We recently set our pipelines to send aab files to App Center, instead of apk files.
It seems that our bundle was resigned by App Center with some generated keystore. That's how App Center distributed apk files, even though our pipeline uploaded aab files.
In other words: even though our pipeline is using our own keystore to sign the aab bundle, in order to distribute through the App Center, after sending the aab to App Center, the App Center is creating universal apks with another generated keystore.
After rolling back our pipeline to send apk instead of aab, Google SignIn on our react-native app with firebase was working again.
"When you distribute Android Application Bundle (AAB), App Center generates a universal APK, signs it with a generated signing key, and distributes it to a device."
Source: https://learn.microsoft.com/en-us/appcenter/distribution/uploading

Google Sign-In configuration file for multiple developers

I'm developing an Android app with a friend and we've just implemented the functionality to sign in with a Google account (https://developers.google.com/identity/sign-in/web/sign-in).
The code works fine on his phone and if he sends me the .apk it runs fine on mine as well. If I try to build the source code in Android Studio though the app behaves differently. Now I get a 12501 ("SIGN_IN_CANCELLED") error code back from the Auth.GoogleSignInApi.getSignInResultFromIntent() call. The fact that it works with an .apk built on his machine but not with the source code built on mine seems to suggest to me that the problem lies within the google-services.json configuration file which was created using my friend's SHA-1 androiddebugkey which clashes with my SHA-1 key used to build the code.
My question then is whether this indeed is the cause of my trouble and what the solution to this problem is. Should a google-services.json configuration file be created for each developer?
Yes, this the cause. This is happening when you are building the android apk it is using the google-services.json file which has been created using your friends SHA-1 key.
I hope the following answer helps
https://stackoverflow.com/a/37386608

Is there another place to get a google-services.json?

I tried clicking the GET A CONFIGURATION FILE link from the docs, but the resulting page just loads and loads. This happens in Firefox and Chrome and on my phone. Is there some other way to get a config file?
EDIT: I am getting these errors in Chrome Dev Console:
Refused to display 'https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…ed%253Dtrue%26cntlbl%3DContinue%2BAdding%2BSign-In%26cntapi%3Dsignin&hl=en' in a frame because it set 'X-Frame-Options' to 'DENY'.
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://console.developers.google.com') does not match the recipient window's origin ('null').(anonymous function) # script_foot.js:348n.event.dispatch # jquery.min.js:3r.handle # jquery.min.js:3
This might be a temporary issue due to network connectivity or something like that.
One solution would be to try again at a later point in time. This might be happening because you're trying to download the google-services.json for the sample project (com.google.samples.quickstart.signin).
If you want result now, you could follow the steps to integrate the Google Sign In into your app.
Create a new empty android studio project/if you have an existing
project skip this step.
Use this link and follow the onscreen instructions to generate the google-services.json for your app.
The app name here refers to your project name in Google Developers
Console. If you've already setup your Google developers console
project for your android app, you can select that via the drop-down
menu. If you have not created one, just enter a name and that
project will be created for you in your developers console.
Select the google services you need for your project viz Google Sign
In, Google Cloud Messaging, AdMob etc. In our case, we just selected
Google Sign In.
You will be asked for SHA-1 hash. Follow these steps to get one.
Click on generate configuration files. Next screen you will be presented with an option to download google-services.json for your app. Download that and you're good to go.
Once you have the google-services.json, follow these steps to complete the Google Sign In.
References
Start Integrating Google Sign-In into Your Android App,
Integrating Google Sign-In into Your Android App.
You will get "google-services.json" as soon as you create a Firebase project.
But, in case you missed and forgot to download that, you can still get the JSON file from the existing project-
Just select the project from firebase console.
Head over to project settings
scroll down (Yeah!, there it is!)
Screenshot :
OK, I've found a workaround if anyone else is having this problem.
Based on the error message about being unable to display https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…ed%253Dtrue%26cntlbl%3DContinue%2BAdding%2BSign-In%26cntapi%3Dsignin&hl=en in a frame... I just followed that link directly.
EDIT: None of the other links were working for me. If you came searching for the console errors Refused to display..., this is the answer for you. This bug seems to have been fixed for the google-services.json, so if you're just looking for the link, the highest-rated answer is the one you want.
Referring to this page:
The Firebase console will help you download the google-services.json. In addition, the Quickstart guides for most APIs have instructions for generating this file. Once you have downloaded the google-services.json file, copy it into the app/ folder of your Android Studio project, or into the app/src/{build_type} folder if you are using multiple build types.
So go to Firebase Console, press add new project and follow instructions

Android Studio - using Google Maps API's key by multiple developers

I'm dealing with an strange issue. I've followed multiple threads from forums here and nothing helped.
We are developing an Android application where we use Google Maps API v2. We are using Android Studio.
My collegue has registered our project on Google Developers Console, activated Google Maps API for the project and created new public key for the application. Then he registered that key in our AndroidManifest.xml file:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="OUR_KEY_VALUE" />
and it works perfectly fine for him when he debugs the application in Android Studio on his mobile.
The problem is that I have the same source code as he has and when I debug or run our app on my mobile phone, the map we are using is blank and is not showing the map.
Interesting thing is that if my collegue send me the app-debug.apk file generated during Android Studio's build and I install it everything work ok and the map is there. Also when this .apk file is installed on different phones it works fine.
When I generate the app-debug.apk file using Android Studio and try to install it on my phone, map is not showing.
We even created the release key for our app and it works exactly the same.
What could be the cause that we both cannot debug the application working with the same API's key?
Thanks for your help!
You must register all keys of all of your team members. Google API Console allows to put many packages/keys per Google Maps Key. Just ask all members for their debug certificate and add new entry <PRINT>:<PACKAGE ID> per each developer. It's not true that all devs must share debug certificate. This is wrong! You need just to register each of your devs with the Google API console. That way you can easily disable developer access if i.e. he leave the company.
For future users:
The debug/release keystore used to generate Google API Key must be the same when you debug/run your app.

Importing existing Android project from github that uses Google Maps API, Google Authentication fails

I'm new to using github, but I am somewhat positive I have it configured in eclipse properly.
I'm also new to using the Google Maps API. However, the other people working on the project already have it configured with the API key and it works for them.
In my case, however:
The project successfully imports. When I run the app on my nexus 7 through eclipse, the app runs.
When the google maps api is called, the map opens but it without any map data (blank).
The console is showing a Google Authentication error.
Do I have to use my own API key?
Thanks
Assuming the API key is hardcoded in the AndroidManifest.xml in the project: ask one of the others developers to give you debug keystore from their ~/.android/ (C:\Users\somename\.android\ on Windows) folder and put it in the same location on your machine.

Categories

Resources