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

3.4.0-rc.4 exception that was not in previous versions #364

Open
gposse opened this issue May 8, 2024 · 4 comments
Open

3.4.0-rc.4 exception that was not in previous versions #364

gposse opened this issue May 8, 2024 · 4 comments

Comments

@gposse
Copy link

gposse commented May 8, 2024

First line of this method:

public void signIn(PluginCall call) {
Intent signInIntent = googleSignInClient.getSignInIntent();
startActivityForResult(call, signInIntent, "signInResult");
}
generates an exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent()' on a null object reference                                                    at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.signIn(GoogleAuth.java:81)

Both, clientId is defined in capacitor.config.ts and server_client_id in strings.xml.

3.4.0-rc.0 does not generate the exception, having the same conditions.

@invenktive
Copy link

Same issue happening with us at Capacitor 6.0.0 + plugin 3.4.0-rc.4. It does not work with the options being set only at capacitor.config.{ts,json} file or at strings.xml, but if I provide options as parameter GoogleAuth.initialize({...options}) it doesn't throw.

@cuvant
Copy link

cuvant commented May 26, 2024

Apparently, to "fix" the issue, you need to call GoogleAuth.initialize({});. This solved the problem on IOS and Web, however, Android doesn't work.

I will try to figure out a solution in a couple of days.

@selcuk-sahin
Copy link
Contributor

I can confirm calling GoogleAuth.initialize({}) fixed my issue on both Android & iOS.

I didn't define androidClientID anywhere, but registered a google.json file with gms.
I'm also using other google services such as firebase analytics & crashlytics.

@capacitor/android: "6.1.0"
For reference here's my capacitor config.ts:

    GoogleAuth: {
      scopes: ["profile", "email"],
      clientId: "12345-abc123.apps.googleusercontent.com",
      iosClientId: "12345-abc123.apps.googleusercontent.com",
    },

@anthonyplews
Copy link

This didn't work for me after upgrading to capacitor 6.1.0 + plugin 3.4.0-rc.4. I'm also calling GoogleAuth.initialize({}).

Any suggestions?

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

5 participants