Skip to content

Google Sign-In Silent Login Fails After First-Time Login in Unity (Need Sample Unity Package) #272

Open
@shiva30122

Description

@shiva30122

I am integrating Google Sign-In authentication in Unity and need a simple demo project (Unity package) to make integration easy for others like me.

My Requirements:

I am using only WebClientId to retrieve the ServerAuthCode.

I do NOT need Firebase Auth just ServerAuthCode for PlayFab authentication.

First-time login works, but Silent Login (SignInSilently) fails after reopening the app.
I am using the latest Google Play Services Auth & Credential Manager API in my Unity project.
Issue Details:
On first-time login, everything works fine:
✅ User signs in
✅ ServerAuthCode is retrieved
However, when I close and reopen the app, silent login fails with this error:

Unity AndroidJavaException: java.lang.NullPointerException
Exception of type 'Google.GoogleSignIn+SignInException' was thrown.
onFailure class androidx.credentials.exceptions.GetCredentialCancellationException : activity is cancelled by the user.
Expected Solution:
A sample Unity project (.unitypackage) with proper Google Sign-In integration.
Ensure Silent Login works consistently after reopening the app.
Only retrieve ServerAuthCode (not Firebase authentication).
Use latest Credential Manager API for authentication.
Extra Notes:
My dependencies (dependencies.xml) include:xml

I have verified my WebClientId is correct.
I need a working Unity sample to easily integrate and test.

📌 Please provide a working Unity Package (.unitypackage) sample!
Would really appreciate help on fixing Silent Sign-In issues after app restart! 🚀🔥

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions