Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRONG SIGNIN Error: unknown status code: 12501 #281

Closed
hustlerism opened this issue Aug 24, 2017 · 7 comments
Closed

WRONG SIGNIN Error: unknown status code: 12501 #281

hustlerism opened this issue Aug 24, 2017 · 7 comments
Labels

Comments

@hustlerism
Copy link

Error message:

WRONG SIGNIN Error: unknown status code: 12501

I'm getting this error after cancelling google login using android back button.

FYI, i can sign in successfully using below code. This only happened if i try to cancel the login when the account popup appeared.

Google sign in code with firebase

GoogleSignin.signIn().then((user) => { 
        if (user){
            console.log('google sign user:' + user);
            const credential = firebase.auth.GoogleAuthProvider.credential(user.idToken, user.accessToken)
            firebase.auth().signInWithCredential(credential)
                .then((result) => {
                    console.log('LOGGED using firebase! ' , result)
                })
                .catch((error) => {
                    console.log('Firebase auth error ', error)
                })
        } else {
            console.log("Cancelled google signin");
        }
    })
    .catch((err) => {
        console.log('WRONG SIGNIN', err);
    }).done();

componentDidMount

componentDidMount () {
        GoogleSignin.hasPlayServices({ autoResolve: true})
            .then( () => {
            GoogleSignin.configure({
                offlineAccess: false,
            })
            .then(()=> {
                GoogleSignin.currentUserAsync().then((user) => {
                console.log('Google USER in did mount: ', user);
                this.setState({ user: user})
                }).done();
            })
        })
        .catch((err) => {
            console.log("Play services error: Error code(",err.code +") Error Message(", err.message + (")"))
        })

What I've done:

  • Already re-created the google-services.json file (problem not solved)
@uniwalk
Copy link

uniwalk commented Aug 25, 2017

I think it is an expected result (error) code, which notify us (the developer) the reason of the sign-in failure -- the failure was caused by user's action.

FYI, there are some more useful error codes I encountered previously when using this package:

    switch (err.code) {
      case -5:
        // It happens on iOS: app launched the sign in screen, but user refuses to sign in (via pressing BACK button on upper left corner)

      case 8:
        // It happens on android: app launched the signin dialog (for user picking his account), 
        // but user dismisses the signin dialog **before** it shows up (either via BACK button or touching outside area of the dialog)

      case 12501:
        // It happens on android: app launched the signin dialog (for user picking his account),
        // but user dismisses the signin dialog **after** it shows up (either via BACK button or touching outside area of the dialog)

        // all above error codes reflect that user refused to sign in. The app should provide consequence according to your app's nature.
        break;

      default:
          // other error codes means sign-in really failed, we possibly need to display some error message, or even ask user to try sign in again.
          break;
    }

Above codes are to be put in the catch block.

@hustlerism
Copy link
Author

@heapwalker so i'm abit confused now. Is this working as expected or it is an issue?

@uniwalk
Copy link

uniwalk commented Aug 25, 2017

It is working.

If user refuses to sign in to your app, you can't force them, right?
Those 3 error codes just aim to let you (the developer and the app) know the occurrence of such scenario.

@hustlerism
Copy link
Author

Hmm.. weird.

But i saw someone posted the same issue as this.

#98

@uniwalk
Copy link

uniwalk commented Aug 25, 2017

It might be useful: GoogleSignInStatusCodes.html#SIGN_IN_CANCELLED

But still got no idea where the 8 comes from.

@dougmbarcellos
Copy link

dougmbarcellos commented Jan 20, 2018

The following documentation contains other error codes, in addition to what @uniwalk has already put here.

CommonStatusCodes

I just did not find the code -5.

@AndreiCalazans
Copy link
Collaborator

Not a bug, expected behavior. I'll add to this a list of TODO to try to improve cancel attempt handling on the next release. Please open a new issue if this is a still a problem...

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants