flutter google_sign_in get id token without firebase
Yes You can.
I had this working long time back with PHP that would take care of the google-auth token validation.
This is with respect to google_sign_in: ^4.4.2
-
Create a GCP project at https://console.cloud.google.com/projectcreate
-
Next go to https://developers.google.com/identity/sign-in/web/sign-in and select Configure Project, client as Android. Enter Package name and SHA1
Generating SHA1 signing certificates.
-
Execute in terminal (assign a password and some other parameters)
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias androiddebugkey
-
From the above step you will have a
key.jks
file for you. -
In
android/app/build.gradle
under android add these settings:signingConfigs { debug { storeFile file('key.jks') storePassword 'epynic' keyAlias 'androiddebugkey' keyPassword 'epynic' } } buildTypes { debug { signingConfig signingConfigs.debug } }
storeFile file('/home/epynic/key.jks')
- path to your key file generated in step 2storePassword 'epynic'
&keyPassword 'epynic'
the password used to generate the key in step 2. -
In termial execute
keytool -keystore key.jks -list -v
and in the output you’ll have the SHA-1 fingerprint. -
Find your package name at
AndroidManifest.xml
file, under thepackage=
attribute.
Sano
Updated on December 31, 2022Comments
-
Sano over 1 year
I looked at a lot of post related to this topic but none were able to solve my problem so here it is: I use google_sign_in to be able to authenticate with a gmail account all without going through firebase. Everything is going well and I retrieve the user information well but the concern is that the value of my idToken is null whatever my manipulation. However, I did register my app via the google console and here is my code:
final GoogleSignInAccount user = await googleSignIn.signIn(); GoogleSignInAuthentication googleSignInAuthentication = await user.authentication; print('======== Google auth ==========='); print(googleSignInAuthentication.accessToken); print(googleSignInAuthentication.idToken); print('===================');
And here is what it returns to me:
I get the access token well but the token id is null and I would like to know:
- Is it possible to retrieve the idToken without going through firebase when you have a custom API?
- If not, in which part is the method entered to be able to retrieve this token?
-
Sano over 2 yearsSorry for the response time, I have already performed these steps but unfortunately it still results in a null idtoken.
-
dustinnoyes over 2 yearsStill getting null for
idtoken
as well.