react-native-google-signin / google-signin

Google Sign-in for your React Native applications
https://react-native-google-signin.github.io/
MIT License
3.18k stars 877 forks source link

GoogleSigninError: A non-recoverable sign in failure occurred #265

Closed shyam528 closed 7 years ago

shyam528 commented 7 years ago

Hello, I have update the files as you described in doc. and I am getting below error { [GoogleSigninError: A non-recoverable sign in failure occurred] name: 'GoogleSigninError', code: 12500 }

shyam528 commented 7 years ago

I have used android client id instead of webclient id . it is solved now

bailey1995 commented 7 years ago

I have this problem. How did you fix it? I don't really get what you mean when you say android client id instead of web client id

xhirazi commented 5 years ago

@shyam528 please provide some more details how you solve it, what does it mean Android client id ?

Ramaraju1992 commented 5 years ago

@sherazi-maavan we can find Android Client Id from OAuth 2.0 client IDs section in here https://console.developers.google.com/apis/credentials?project=your_project_id .

In google developer console, in Credentials page you can find the Client Ids

sonlexqt commented 5 years ago

@shyam528 Did you mean that we should you the web client ID instead of android client ID ?

0xpatrickdev commented 5 years ago

@shyam528 (or anyone else reading along), did you mean for this step:

GoogleSignin.configure({
  scopes: ['https://www.googleapis.com/auth/drive.readonly'], // what API you want to access on behalf of the user, default is email and profile
  webClientId: '<FROM DEVELOPER CONSOLE>', // client ID of type WEB for your server (needed to verify user ID and offline access)
  offlineAccess: true, // if you want to access Google API on behalf of the user FROM YOUR SERVER
  hostedDomain: '', // specifies a hosted domain restriction
  forceConsentPrompt: true, // [Android] if you want to show the authorization prompt at each login
  accountName: '', // [Android] specifies an account name on the device that should be used
  iosClientId: '<FROM DEVELOPER CONSOLE>', // [iOS] optional, if you want to specify the client ID of type iOS (otherwise, it is taken from GoogleService-Info.plist)
});

you put the android client id instead of the web id for the webClientId field?

And to determine the android clientId versus the webClientId, if your google-services.json looked something like this:

{
  "project_info": {
    "project_number": "12345678",
    "firebase_url": "https://comcommyapp.firebaseio.com",
    "project_id": "comcommyapp",
    "storage_bucket": "comcommyapp.appspot.com"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:15564864124:android:4564asdfe48134",
        "android_client_info": {
          "package_name": "com.myapp.myapp"
        }
      },
      "oauth_client": [
        {
          "client_id": "12345678-5a1sdadfasd5f1aasdfe561651.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.myapp.myapp",
            "certificate_hash": "basdaf123451adfaer13451avbzzz"
          }
        },
        {
          "client_id": "12345678-asdfq323fawefaw45151aefafe1.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AI_Qj123R__aq31413fafb"
        }
      ],
    }
  ],
}

you'd use 12345678-5a1sdadfasd5f1aasdfe561651.apps.googleusercontent.com for the webClientId instead of 12345678-asdfq323fawefaw45151aefafe1.apps.googleusercontent.com?

I am currently using 12345678-asdfq323fawefaw45151aefafe1.apps.googleusercontent.com, which seems to be working for some people, but I am also seeing the 12500 error for others :/

Edit: CC'ing #543 as it's related

jonatslab commented 5 years ago

any fix? experiencing this error..

ajiehatajie commented 5 years ago

same problems

HadrienPierart commented 5 years ago

I've added a potential solution over there : https://github.com/react-native-community/react-native-google-signin/issues/543#issuecomment-433362576

ajiehatajie commented 5 years ago

i'm created tutorial google sign https://youtu.be/E6Rdg0reKRI

uendar commented 5 years ago
 GoogleSignin.hasPlayServices().then(()=>{
        }).catch((err)=>{
            console.log("Play service error", err.code, err.message);
        })

        GoogleSignin.configure({
            scopes: ['https://www.googleapis.com/auth/drive.readonly'], // what API you want to access on behalf of the user, default is email and profile
            ClientId:             
          });
        }

use CliendId instead webClientid and get the CliendId from https://console.developers.google.com/apis/credentials?project = "Your project Name". Dont forget to replace cliendt id in google-servcies.json too.

kalraneeraj24550 commented 5 years ago

any solution , i am facing this error. A non-recoverable sign in failure occurred

uendar commented 5 years ago

Check the id. The firebase id is diffeent from google console id.

Try this:

GoogleSignin.configure({
    scopes: ['https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.metadata', 'https://www.googleapis.com/auth/drive.appdata', 'https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/drive.metadata.readonly', 'https://www.googleapis.com/auth/drive.scripts', 'https://www.googleapis.com/auth/drive.readonly', 'https://www.googleapis.com/auth/drive.photos.readonly'],
    ClientId:'........apps.googleusercontent.com',       

  });

This CliendId is not the id found in google-services. Is different fom firebase id.

kalraneeraj24550 commented 5 years ago

@uendar sir, i did as you said, screenshot from 2018-12-18 11-20-39

and here below is my code... screenshot from 2018-12-18 11-19-49

sir, still getting error, plz help me sir. i am noob in react-native

uendar commented 5 years ago

Make sure you enable your project https://console.developers.google.com/apis/library/drive.googleapis.com...... and try. if there is any problem tell me :)

kalraneeraj24550 commented 5 years ago

sir, still getting same error

kalraneeraj24550 commented 5 years ago

screenshot from 2018-12-18 14-54-11 i have enabled

uendar commented 5 years ago

Did you do the configuration as in document descrription?

On Tue, Dec 18, 2018 at 10:24 AM kalraneeraj24550 notifications@github.com wrote:

[image: screenshot from 2018-12-18 14-54-11] https://user-images.githubusercontent.com/44640902/50144276-cf8da680-02d4-11e9-9475-5aed49a5dd49.png i have enabled

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-google-signin/issues/265#issuecomment-448153276, or mute the thread https://github.com/notifications/unsubscribe-auth/ANQWJapx3n0NjV-B9wuRWwf89Dhh4fetks5u6LRagaJpZM4OmbGa .

kalraneeraj24550 commented 5 years ago

yes sir, i did. which file would you like me to show you

uendar commented 5 years ago

well i can shate a demo project where react-native-google-signin works. You can check the configurations. If there are problems again write me

On Tue, Dec 18, 2018 at 10:29 AM kalraneeraj24550 notifications@github.com wrote:

yes sir, i did. which file would you like me to show you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-google-signin/issues/265#issuecomment-448154729, or mute the thread https://github.com/notifications/unsubscribe-auth/ANQWJbXkR-Hd58PZ0YMjRY7XY3_yqikZks5u6LWEgaJpZM4OmbGa .

uendar commented 5 years ago

give me your email i can check your project if you want :)

On Tue, Dec 18, 2018 at 10:32 AM Endar Uliu endar8@gmail.com wrote:

well i can shate a demo project where react-native-google-signin works. You can check the configurations. If there are problems again write me

On Tue, Dec 18, 2018 at 10:29 AM kalraneeraj24550 < notifications@github.com> wrote:

yes sir, i did. which file would you like me to show you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-google-signin/issues/265#issuecomment-448154729, or mute the thread https://github.com/notifications/unsubscribe-auth/ANQWJbXkR-Hd58PZ0YMjRY7XY3_yqikZks5u6LWEgaJpZM4OmbGa .

kalraneeraj24550 commented 5 years ago

my email is neeraj.emilence@gmail.com yes you can check my project. thanks sir, for helping me

kalraneeraj24550 commented 5 years ago

anyone plz suggest me, am still facing this issue. A non- recoverable signin failure occured 12500

zvs001 commented 5 years ago

I fixed by adding correct SHA certificate fingerprint to my firebase project. This key was by default for me: keytool -exportcert -keystore ~/.android/debug.keystore -list -v

kalraneeraj24550 commented 5 years ago

how to get correct sha. bcoz i have already added SHA certificate. got by this command. keytool -exportcert -keystore ~/.android/debug.keystore -list -v. how can we get know that our sha is correct or not

ashwath20 commented 5 years ago

tried almost all above solutions (enabled all the APIs from google console,tried both client id and weclient id,updated fingerprint) nothing solved my problem

ashwath20 commented 5 years ago

Even i had the same error it took a whole day for me to solve it. It was because of the SHA -1 certificate problem. i gave the value from different keystore in the firebase ,hence google-services.json had some wrong client id which was making the request fail so i did the following steps. 1)deleted the SHA-1 key from firebase 2) generated the key (referring to this article ->[https://developers.google.com/android/guides/client-auth]) 3)placed the key in the fire base and generated new google -services.json file

always use :- keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
commond dont even change the path(in windows) default password:-android

kalraneeraj24550 commented 5 years ago

@ashwath20 sir, what did you mean by "gave the value from different keystore". i did the steps as you did am still facing the same error. and the web client id is same in firebase as same in google-services.json file. i have no idea where am lacking. sir, can you plz guide me

ashwath20 commented 5 years ago

your client id is based on the SHA1 key you provide . so generate the key from "%USERPROFILE%.android\debug.keystore" @kalraneeraj24550

kalraneeraj24550 commented 5 years ago

i have solved it by having sha-1 from android studio not by command line

hack-and-backslash commented 5 years ago

In my case, I was getting this because I switched my system and that now had a different debug.keystore. Didn't know that initially, but when I did, I followed this and added the new SHA1 to firebase console. Worked for me!

http://developerextensions.com/help/230-Google-signin-returns-12500,-12501-error-code-

anurbecirovic commented 5 years ago

I had a same problem. I switched from one mac to another, and the SHA-1 is changed. I needed to generate new SHA-1 and update firebase console. Also after you add new SHA-1 to firebase, you need to download new google-services.json and replace with older one in your android project app folder. Thank you @amit-gitrepo for hint.

ogalaxy-gs commented 5 years ago

Set Support email in firebase settings

ckOfor commented 5 years ago

I searches and came across the following steps

  1. Enable OAuth on https://console.developers.google.com
  2. Copy and paste your SH1 while enabling
  3. Enable Google sign in on firebase authentication
  4. Add sha-256 to firebase android app settings
  5. Use Oauth Client_Id instead of your WebClient ID
jasperkuperus commented 4 years ago

What worked for me:

BenHurMartins commented 4 years ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

Man, i want to kiss your foots, I was trying for two days and now it is working!!! Thank you so much

anastely commented 4 years ago

@jasperkuperus I'm trying all steps but I got this error on 'release Apk'

Error: A non-recoverable sign in failure occurred

Although In development I don't get any error and I can sign in!

rajupushpad commented 4 years ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

Thanks; Its working and proper steps to solve this issue .

6pm commented 4 years ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

This instruction works for apk and local debugging. For.aab builds it not works. But it's easy to fix, go to: play store console -> your app -> Release management -> App signing
Under "App signing certificate" section copy your SHA1 key and paste it as on 3rd step-

  1. Firebase Console under Project Settings, Android app, add the SHA1
Ghcml commented 4 years ago

try with a physical device since in the emulator it did not work but with the physical device yes, I followed the steps of @jasperkuperus

henriquebarrosx commented 3 years ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

I tried it in React Native CLI and worked! Maybe in expo project should be run in production mode.

jatin-codes commented 3 years ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

@jasperkuperus Should we not be using the SHA1 key thats linked to Task :react-native-community_google-signin:signingReport instead? its interesting to find out that the path of the signing Key you mentioned and Task :react-native-community_google-signin:signingReport are not same. one is defined inside app the other is defined globally. any thoughts on it?

jasperkuperus commented 3 years ago

@jasperkuperus Should we not be using the SHA1 key thats linked to Task :react-native-community_google-signin:signingReport instead? its interesting to find out that the path of the signing Key you mentioned and Task :react-native-community_google-signin:signingReport are not same. one is defined inside app the other is defined globally. any thoughts on it?

Sorry, this is quite a long time ago. I don't really remember and I'm not very familiar with this. I just know that my approach worked for me. If what you propose is better, and works... Then that might be a better answer. But maybe a contributor can chime in on this? I have a lack of knowledge to properly answer your question.

jatin-codes commented 3 years ago

Thanks @jasperkuperus !! Until an actual contributor can share their thoughts, https://github.com/react-native-google-signin/google-signin/issues/265#issuecomment-616072044 fixed my issue. 🙌 🚀

Raunak-Agrawal commented 3 years ago

If anyone facing this issue still, don't use the default webClientId created by your firebase project. Create a new web client Id from the google cloud developer console for your project and use that instead.

ch3coo2ca commented 3 years ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it in the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

I've been struggling with this for hours today and it finally solved my issue 😭 Thank you so much!

racmathafidz commented 1 year ago

What worked for me:

  • cd ./android && ./gradlew signingReport
  • Take the SHA1 of Task :app:signingReport, Variant: debugAndroidTest, Config: debug
  • Update it the Firebase Console under Project Settings, Android app, add the SHA1
  • Download the google-services.json, put it in ./android/app
  • Go to Authentication, then Sign-in method, then press Google
  • Take the Web client ID and use that for your GoogleSignin.configure({ webClientId: ... });
  • This Web client ID should be the same as listed in https://console.developers.google.com/apis/credentials?project=<your_project_id> -> Credentials -> OAuth 2 Client ID -> Web Client

This instruction works for apk and local debugging. For.aab builds it not works. But it's easy to fix, go to: play store console -> your app -> Release management -> App signing Under "App signing certificate" section copy your SHA1 key and paste it as on 3rd step- 3. Firebase Console under Project Settings, Android app, add the SHA1

My local app works properly but my release app on google play still getting this error. Following this step and now my release app on google play working properly! Thank you so much! You saved my day! @6pm

R4tch3t commented 11 months ago

not worked for me :(

R4tch3t commented 11 months ago

ok how works on emulator???