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

Android: Error: Login action cancelled after first sign-in #1088

Open
KMarkovskiy opened this issue Aug 3, 2022 · 22 comments
Open

Android: Error: Login action cancelled after first sign-in #1088

KMarkovskiy opened this issue Aug 3, 2022 · 22 comments

Comments

@KMarkovskiy
Copy link

When creating a new user using the Google platform identity (https://admin.google.com), the first time I sign in to the app in android(for iOS works fine), I get Error: Login action cancelled. When creating a new user in the normal interface, the user sounds like this.

When you sign-in again, the problem is also not observed.

This is an example using what I am trying to do. Google wing in will be used to enter firebase, but the error falls before it reaches the firebase function.

import React from 'react';
import type {Node} from 'react';
import {
  Button,
  SafeAreaView,
} from "react-native";

import auth from '@react-native-firebase/auth';
import { GoogleSignin } from '@react-native-google-signin/google-signin';

const App: () => Node = () => {

  async function onGoogleButtonPress() {
    // Get the users ID token
    const { idToken } = await GoogleSignin.signIn();

    // Create a Google credential with the token
    const googleCredential = auth.GoogleAuthProvider.credential(idToken);

    // Sign-in the user with the credential
    await auth().signInWithCredential(googleCredential);

    const token = await auth().currentUser?.getIdToken();

    console.log("### token", token);
  }

  return (
    <SafeAreaView>
      <Button
        title="Google Sign-In"
        onPress={() => onGoogleButtonPress().then(() => console.log('Signed in with Google!'))}
      />
      <Button
        title="Google Sign-Out"
        onPress={async () => {
          await auth().signOut();
          await GoogleSignin.signOut();
        }}
      />
    </SafeAreaView>
  );
};

export default App;

Expected results

Error: Login action cancelled

Actual Behavior

Success sign-in

Environment

  • react-native version "0.69.3"
  • @react-native-google-signin/google-signin version "8.0.0"
  • Pixel 2 API 30 , Android 11
@seora
Copy link

seora commented Dec 14, 2022

same problem as me. I took a log and the id token returned as null and an error popped up

@BrodaNoel
Copy link

Same problem here (I guess).
90% of the users that are opening the app in Android, and open get Sign in action cancelled.

This is my code, am I missing something?

import { GoogleSignin } from '@react-native-google-signin/google-signin';

// ...

try {
  GoogleSignin.configure();

  await GoogleSignin.hasPlayServices();
  const { user } = await GoogleSignin.signIn();

} catch (error) {
  actions.errors.track(error);
}

@BrodaNoel
Copy link

I just checked Sentry and seems like this issue is happening right after upgrading to Expo SDK 47

@BrodaNoel
Copy link

I just realized I forgot to add @react-native-google-signin/google-signin in the plugins in app.json file.
Will create a new build right now and see what happens tomorrow after some users try the app

@BrodaNoel
Copy link

@KMarkovskiy @seora could you also check if you forget that line and see if that fixes the error

@EasonHeee
Copy link

Hey @BrodaNoel thanks for reporting. I am seeing the same issue, is there a way to solve the cancelled login issue?

@vioku
Copy link

vioku commented Feb 24, 2024

same problem

@andrisole92
Copy link

Same problem!!!

@andrisole92
Copy link

Funny thing is it does not happen on emulator, but on Prod it happens

@andrisole92
Copy link

andrisole92 commented Mar 16, 2024

It's fairly critical. I just discovered that Googe Sign In does not work for another app in prod, but works on emulator. I was surprised why nobody is creating an account after downloads...

@andrisole92
Copy link

andrisole92 commented Mar 16, 2024

@vonovak please have a look or update the status - it happens to 2 of my apps in production.

@vonovak
Copy link
Member

vonovak commented Mar 17, 2024

@andrisole92 thanks for your comment; However your issue appears to be different from the original one.
For me, there isn't really anything to look at - there's no runnable reproduction of the issue.

If the issue is critical to you and you need extra help, you can hire me - contact information is in my profile.
Thank you 🙂

@andrisole92
Copy link

Hey @vonovak ,

Could you please add something like Don't use in production on Android for Expo projects - the package is broken

It makes me feel outrageous that I have to pay for a third-party Google Sign-in plugin while the official open-source version is broken.

@BrodaNoel
Copy link

Hey @vonovak ,

Could you please add something like Don't use in production on Android for Expo projects - the package is broken

It makes me feel outrageous that I have to pay for a third-party Google Sign-in plugin while the official open-source version is broken.

This is not an official library. This is not inside Google account.

@vonovak
Copy link
Member

vonovak commented Mar 18, 2024

Hi @andrisole92 ,
You have not yet presented a prove that the problem you're seeing is due to this library, and I therefore don't see a reason to declare that it's broken.

Secondly, as was already correctly noted, there's no "official" Google sign in open source package for react native or for Android, for that matter.

As for your feeling, I'm sorry that you feel that way but allow me to explain - the reason why the "premium" package exists is to fund the maintenance of the resources in this organization. That includes both the private and public repositories, documentation and even contributions outside of this organization (AppAuth for IOS). I have spent a lot of my free time on making these, and sponsors make the efforts sustainable.

Lastly, you don't "have to" pay for anything, and if you have a problem, you're in a great position to fix it.

Thank you 🙂

@andrisole92
Copy link

andrisole92 commented Mar 18, 2024

Hi @vonovak ,

I understand that you just want to make money and get paid for your hard work, but as for me - I feel like I got free ice cream that was poisoned, and now you are asking to pay for the cure. How would you feel?

I am also saddened that you don't trust my word that the package is broken in prod. If you are so interested - I can share crash logs with you.

I can also invite you to the internal testing group of Andorid app using the latest open source version of the package - so you can see for yourself. I can also share with you my marketing bill.

I would suggest either:

  1. Making the package fully open-source
  2. Making the package fully closed-source
  3. Making the open-source version at least working in production, as it currently does not. Maybe at least the legacy GoogleSign and making oneTap premium.

I also have to spend my time to explain those things to you - and not getting paid for it.

@andrisole92
Copy link

P.S. If you don't have time to fix it right away - please at least add some warning so that other people don't get into the same trap.

@vonovak
Copy link
Member

vonovak commented Mar 20, 2024

hello again,

I feel like I got free ice cream that was poisoned

I'm sorry you feel that way. It seems what you're saying is that I either introduced a major bug, or knowingly keep one in the OSS code - and I want to deny that. There are differences in functionality between the "original google sign in" module for sponsors and the free one but they are very minor.

What you're getting for sponsoring is new architecture support and one tap sign in, which is a very different implementation from the "original sign in".

I am also saddened that you don't trust my word that the package is broken in prod.

I trust your word that you're running into an issue. Do I trust that it's because of this package? Well, I'd be repeating myself here so I'll refer to my above comment(s).

Here's a video of the OSS Google sign in, in an app that's built with release build config, on a physical device. I recorded it now.

SVID_20240320_092959_1.mp4

Please don't invite me to your testing groups and etc. If I am to do anything about your issue, I need https://stackoverflow.com/help/minimal-reproducible-example

There's nothing more to add from my side, thank you for your comments. :)

@TheoOliveira
Copy link

I just realized I forgot to add @react-native-google-signin/google-signin in the plugins in app.json file. Will create a new build right now and see what happens tomorrow after some users try the app

Did added the plugin to the app.json worked for you?

@BrodaNoel
Copy link

I just realized I forgot to add @react-native-google-signin/google-signin in the plugins in app.json file. Will create a new build right now and see what happens tomorrow after some users try the app

Did added the plugin to the app.json worked for you?

It fixed some of the issues I had. Yes. You always have to add the plugin if it's there. It's a required thing

@andrisole92
Copy link

I just realized I forgot to add @react-native-google-signin/google-signin in the plugins in app.json file. Will create a new build right now and see what happens tomorrow after some users try the app

Did added the plugin to the app.json worked for you?

Nope. This open source project only works if you pay for it.

@TheoOliveira
Copy link

TheoOliveira commented Apr 26, 2024

In my case It was something i wasn't aware. I did everything according to the docs. I am using expo and since i am using default credentials from expo and i already have google play console connected I had to add the upload credential from play store as well to firebase sha1. Hope this helps someone.

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

No branches or pull requests

8 participants