Open sawaca96 opened 3 years ago
What difference between serverClientId and androidClientId ?
What difference between serverClientId and androidClientId ?
me to
Hello, can someone from @CodetrixStudio reply to this thread? 🙏
Finally, I figured out how to use android
For androidClientId in capacitor config, use the client id of the web application Also, To authenticate through the app's sha-1 fingerprint, we also need to create an Android client. After creation, you need to put the app's sha-1 in the Android client.(At this time, if you are using google console app signing, enter sha-1 in google console)
I don't know how the web application client communicates with the android client either. However, as a result of testing, when using the above method, it worked well in both development and deployment environments.
androidClientID : <web application client Id>
should be used. (capacitor)thanks yall. super helpful.
I found that my emulator was super buggy, but I was able to test successfully on an actual android device.
@sawaca96 does that means that I have to sign also the debug version of the apk to use it correctly? I'm not using Android Studio and it's a bit difficult to get the signing thing working for debug build in capacitor compared to cordova which happily accept a build.json file where I can simply put the config for signing.
Ok found the answer by myself. You need the fingerprint from the debug.keystore which is in the user home folder:
keytool -list -v -keystore "C:\Users\USERNAME\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
replace USERNAME with your windows username to get the SHA-1 fingerprint and use that.
@espositofulvio
Regardless of the environment, such as debug, staging, and production, you have to use sha-1 of the keystore that you used to build the app
and then fill the sha-1 for the OAuth client of the Google cloud platform.
Ok found the answer by myself. You need the fingerprint from the debug.keystore which is in the user home folder:
That's right. If you haven't set up anything, that keystore will be used.
Hi, I have the exact same problem but on capacitor-google-auth version 2.1.3 @sawaca96 has this happened to you with earlier versions as well ?
@RAPHAELSTZ
I don't know what happened in earlier version.
I use 3.1.0
@sawaca96
Did you experience problem when doing sigin in android? It keeps saying something went wrong when doing signin in android [getting the results of the sign in]
Hi @kevinpallado,
The problem on my end was that on android you need to use the same key hash config on firebase end as the one you use to sign the app on Android Studio. (also, you need to export the correct google-service.json in the appropriate folder)
Using the same one solved my issue.
@kevinpallado
Yes, I've experiences.
I made two OAuth clients and solved something went wrong
.
One is a web application client and the other is an Android client.
Use Id of the web application client to configure capacitor
And go to google Android client configure, there is a input place for SHA-1. Put the SHA-1 value of the Android app that is you are using
@sawaca96 Using web client ID instead of android solved the issue for me, thanks! Maybe this is because the capacitor app in the end is a simple webview and therefore should be using the web client id? Anyway, the point is that it's working now, thanks for the suggestion!
Does not using the web client id expose the app to anyone who can get hold of the client ID? The mobile app origin is always localhost, client id can easily be found in the apk...
Wondering the same thing. However, we already established that the SHA1 in Android ID must match the signing key of the app package, so my guess is you quota should still be safe. This is only a guess though and I'd love feedback from someone who knows.
This plugin sure is strange. Been trying to fetch the email
const logIn = async () => {
try {
const response = await GoogleAuth.signIn();
alert(JSON.stringify(response.getBasicProfile().getEmail()));
} catch (e) {
//
}
};
or any other way and so far i can click but i cant obtain the email address.
androidClientId for others help SHA1 for debug keystore can be generated from this link to test keytool -list -v -keystore "C:\Users\USERNAME.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
In my case, server.androidScheme
in capacitor.config.ts
was the cause for blank screen of android (without any log in logcat). If I set some value, I get blank screen. At least, I could mitigate the issue by not setting the value.
I found out this behavior by comparing my project with bare-bones scaffold project.
Dont waste your valuable time on this error. Its same error on react native cli and expo. Even on Auth0, there are still errors if you follow the rabbit hole long enough.
Finally, I figured out how to use android
For androidClientId in capacitor config, use the client id of the web application Also, To authenticate through the app's sha-1 fingerprint, we also need to create an Android client. After creation, you need to put the app's sha-1 in the Android client.(At this time, if you are using google console app signing, enter sha-1 in google console)
I don't know how the web application client communicates with the android client either. However, as a result of testing, when using the above method, it worked well in both development and deployment environments.
Summary
- Create both web application client and android client. (google cloud platform)
- For capacitor,
androidClientID : <web application client Id>
should be used. (capacitor)- Enter the correct sha-1 in the android client. (google cloud platform)
Working with the app-release.apk file only, but not the app-release.aab file after uploading playstore. why? could you help?
There are many comment about API Exception: 10
I think most important thing is SHA fingerprint. (Android app and google android client must have the same fingerprint.) So I copy SHA from
~/.android/debug.keystore
Also I can get SHA from android studio → gradle → tasks → android → signingReport
copy SHA1 and past to android client.
But it is not working ! why ?? (error : something went wrong)
I use capacitor3 and vue2 without firebase
below is my config about capacitor and MainActivity
Using Web client
If you used the Web ClientId, google signin is working.
So android type is not working but web application type is working
If you change only androidClientId to WebClient in the same setting as above, it will work.
How Can I use AndroidClientId ? and why WebClient working good ?