DEV Community

Cover image for Google Auth/Signin in React Native without Firebase.

Google Auth/Signin in React Native without Firebase.

Suyash Vashishtha on December 19, 2021

Google auth is one of the most commonly used Authentication methods in Mobile and web apps. Well, it is also a tricky one as compared to normal use...
Collapse
 
geekabdul profile image
Abdul Rehman • Edited

after run this cmd keytool -list -v -keystore app/my_release_key.keystore -alias my_key_alias in my android/app. I'm getting this error

keytool -list -v -keystore app/my_release_key.keystore -alias my_key_alias
keytool error: java.lang.Exception: Keystore file does not exist: app/my_release_key.keystore
java.lang.Exception: Keystore file does not exist: app/my_release_key.keystore
Enter fullscreen mode Exit fullscreen mode
Collapse
 
suyashdev profile image
Suyash Vashishtha

Yeah bcz you have to first generate it using keytool -genkey -v -keystore my_release_key.keystore -alias my_key_alias -keyalg RSA -keysize 2048 -validity 10000 , then make sure you put right path in list command ( mine was app/name ).

Collapse
 
geekabdul profile image
Abdul Rehman

Hey, after solving this I'm getting

[Error: DEVELOPER_ERROR]
Enter fullscreen mode Exit fullscreen mode

when i clicked signin with google button

Thread Thread
 
suyashdev profile image
Suyash Vashishtha

"Yeah, according to google, you have to put your Release Keystore key in Google Console "

4rth heading point in the blog 😅

Collapse
 
karthidreamer profile image
Karthi Keyan

put this instead this assumes you are inside app folder

keytool -list -v -keystore ./my_release_key.keys
tore -alias my_key_alias```

Enter fullscreen mode Exit fullscreen mode
Collapse
 
raj7seasol profile image
raj7seasol

Thanks man it worked for me

Collapse
 
afonsojorge profile image
Afonso-Jorge

Man I did everything I mean every line and im still getting LOG [Error:DEVELOPER_ERROR] ive been trying to fix this without exporting everything Ive done to firebase in the hopes that doind so would make it work. Do you have any other ideas as to why the error would still show up even after following everything you said down to the line?

Collapse
 
suyashdev profile image
Suyash Vashishtha

This error basically comes due to Release SHA Key... make sure you paste the same release key in console which your building app with...

Make sure you did 4.1 step correctly (replace debug SHA keystore with release )

Collapse
 
afonsojorge profile image
Afonso-Jorge

Ended up adding the google-services.json from firebase which allows you to input both the SHA Key from debug.keystore in User/.android/bin and the one in the project directory android/app folder so now it works.

Cheers anyways and for release I´ll just follow what you did except I´ll put the generated SHA Key on firebase and redownload the google-services.json.

Collapse
 
dsantacruz profile image
Diego Santa Cruz • Edited

I got an error with code 10, It was because I had generated the sha-1 with the keystore of the root of my computer; generate with the keystore of the react native project that comes inside the android / app / debug.keystore folder and copy console google oauth android and works.
keytool -keystore android/app/debug.keystore -list -v

Collapse
 
suyashdev profile image
Suyash Vashishtha

Yeah I clearly mentioned that. Although thanks for pointing it, might help someone with similar case :)

Collapse
 
felixkrautschuk profile image
felixkrautschuk

My Google SignIn works when running a debug build on device/emulator and even when running a release build with our release keystore on device/emulator.

But when I upload our release aab to Google Play and download it via internal test, I always get Error Code 10 after I tapped the SignIn Button and choose the account.

I double-checked that the app package name in the OAuth Client in Google Cloud Console is correct and I already added the SHA1-fingerprint from the App Signing section in Google Play Console.

Can anyone help? Thanks in advance!

Collapse
 
felixkrautschuk profile image
felixkrautschuk

never mind, I just found out that there is a separate SHA-fingerprint section for internal testing in Google Play Console, so I had to add another OAuth client ID in cloud console, now it is working

Collapse
 
yue_wang_4a9247785b7daddb profile image
Yue Wang

This is the only guide that works after researching everywhere else.

For those who followed the post and still get an error, remember to also create 2 more android credentials with the SHA-1 you find from google play console. The URL is here:

play.google.com/console/u/0/develo...

I created a dev.to account just to comment on this post. hanks so much for the guide!

Collapse
 
mudit18th profile image
Mudit Kashyap

I am getting this error [Error: A non-recoverable sign in failure occurred]

Collapse
 
karimscript profile image
karimgh

Any solution for this error ?
Im using release keystore SHA-1 with firebase.

Collapse
 
santiago_sarmiento_132cc1 profile image
santiago sarmiento

Could you solve it?

Collapse
 
enggumarpu profile image
Mohammad Umar

Hey, I am facing an issue regarding google login. I have two components in my React Native app, Login and Signup, on Login I click google login button, pop up opens, user clicks its gmail and gets login, fine no issue.
Even I cancel the pop-up right status code is triggered and flow works as expected.

When I click same google login button in Signup, pop-up opens, if i cancel the pop-up statusCodes.SIGN_IN_CANCELLED should trigger but instead statusCodes.IN_PROGRESS gets triggered and I get this error,

Error: Sign-in in progress
Error Code: 12502
Status Code: ASYNC_OP_IN_PROGRESS

Any thoughts what I am doing wrong, or any configuration is missing ?

Collapse
 
neha_gupta_d62546fa1ecb67 profile image
Neha Gupta

I followed all the steps but nothing happens at GoogleSignin.signIn(), no error too. I get true as response from GoogleSignin.hasPlayServices().

Collapse
 
fistelectro profile image
ElectroFist

Ahh finally found something really useful, was stuck on this for days. Thank you

Collapse
 
santiago_sarmiento_132cc1 profile image
santiago sarmiento

Hi ! I did everything and im getting:

[Error: A non-recoverable sign in failure occurred]

When i try the GoogleSingUp Function.

Any ideas ?

Collapse
 
ajay957582 profile image
AJAYmore_16

if we are using web client id , then why we generated the android client ?