Skip to content

Conversation

@Thaina
Copy link

@Thaina Thaina commented Jun 10, 2024

Since there is deprecation and migration recommendation from signin system

: copied from readme >

https://developer.android.com/identity/sign-in/legacy-gsi-migration
https://developers.google.com/identity/sign-in/ios/quick-migration-guide

Thank for ios fix which was cherrypicked from this fork : https://github.com/pillsgood/google-signin-unity

Android was migrated to use CredentialManager and AuthorizationClient since GoogleSignInAccount was deprecated

However, GoogleIdTokenCredential actually not provide numeric unique ID anymore and set email as userId instead, so I have to extract jwt sub value from idToken (which seem like the same id as userId from GoogleSignIn of other platform)

Tested in unity 2021.3.21 and unity 6000.0.4

Add UPM dependency with branch tag https://github.com/Thaina/google-signin-unity.git#newmigration

{
  "dependencies": {
    "com.google.external-dependency-manager": "https://github.com/googlesamples/unity-jar-resolver.git?path=upm",
    "com.google.signin": "https://github.com/Thaina/google-signin-unity.git#newmigration",
}

@google-cla
Copy link

google-cla bot commented Jun 10, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Thaina
Copy link
Author

Thaina commented Jun 10, 2024

@calumma-robert Do you interest in signing google CLA agreement?

@calumma-robert
Copy link

@Thaina done!

@Thaina
Copy link
Author

Thaina commented Jun 10, 2024

Thank you very much

update readme
@Thaina Thaina force-pushed the newmigration branch 2 times, most recently from 3da1816 to 6c3c741 Compare June 13, 2024 12:45
@shiva30122
Copy link

shiva30122 commented Feb 14, 2025

New to GitHub !...
sorry for unwanted message !...

@Thaina

and i tried using only one google account on my mobile then also popup thins select account for silent login() !.

Debugging is not showing any error and it simply login me both normal Sign() or Silently-Login() .

my problem is Silent Login() Issue when user already Login !..... and i tried with code also for making silent login on Star() method not working !.

any solution !??? or Still Development ?... or i need to implement anything manually ??...

now my problem is clear !?..

Unity.package --> Silently-Login_Notworking.zip iam using Unity 6 .

but in last iam getting Debug.Log("ServerAuthCode : " + authCode) ; !.. Working bit only silent login() issue !.

Refer My Video --> https://youtu.be/6DQGnQv-GL0

@Thaina
Copy link
Author

Thaina commented Feb 14, 2025

@shiva30122 There are 3 things I can think of
1 - you may not set HidePopups to true
2- See this comment > #256 (comment)
3 - You have already sign in with google with multiple account in that device. This was one problem of new version of Google credential manager and I can't do anything about it. It will insist to have popup because it was unsure which account you really want to use

@Thaina
Copy link
Author

Thaina commented Feb 14, 2025

@shiva30122 Please investigate the criteria mention in this link to determine if your device's setting are not met any of it

https://developer.android.com/identity/sign-in/credential-manager-siwg#enable-sign-in

@rysenko
Copy link

rysenko commented Jun 25, 2025

@Thaina I'm testing your branch in my app. And I'm facing issue with discrepancies in GoogleSignInStatusCode between platforms. When I open Google Sign-In dialog in the iOS app and instead of continuing the sign-in process I press "Cancel" on account selection popup, I get GoogleSignInStatusCode with value 2 that is treated as SERVICE_VERSION_UPDATE_REQUIRED status by plugin. Seems like status codes are just different now between iOS and Android. iOS still preserves older status code with status code 2 being GoogleSignInStatusCode.Cancel. Is that something you know about and willing to fix in the branch?

@Thaina
Copy link
Author

Thaina commented Jun 25, 2025

I would take a look and try to update the package in near future. There is many things I would like to update too. But currently now very busy though, pardon me that it may not be so soon

Thaina and others added 2 commits July 19, 2025 20:40
#28)

* Adjust runtime configuration for webClientId in GoogleSignIn_Configure

* Fix typo of GIDConfiguration's property
@Milan1660
Copy link

Hello,

I'm currently integrating Google Sign-In in my Unity Android project. While checking library alignment for 16 KB page size using the recommended tooling, I found that the native-googlesignin.so file is not aligned to 16 KB, unlike the other .so libraries in the project.

Alignment Check Result:

Image

Because of this misalignment, I am getting below warning on Google Play Console.

Image

Environment details:

Unity Version: 6000.0.58f2
Google Sign-In Version: 1.0.4
Platform: Android

@Thaina
Copy link
Author

Thaina commented Oct 14, 2025

Are you really using my branch with upm?

@Milan1660
Copy link

Are you really using my branch with upm?

Yes, I am using your branch with UPM

@Thaina
Copy link
Author

Thaina commented Oct 14, 2025

@Milan1660 Have you test by creating clean fresh project and only install EDM4U and google signin?

@Milan1660
Copy link

@Milan1660 Have you test by creating clean fresh project and only install EDM4U and google signin?

Yes, I tried with new project and I am getting alignment issue in this new project.
Have you checked native-googlesignin.so is aligned to 16 KB after build?

@Thaina
Copy link
Author

Thaina commented Oct 14, 2025

I have ask you are you using my branch because I don't think my branch using native-googlesignin.so anymore. It should not even build native-googlesignin.so out of the repo

Maybe native-googlesignin.so is in the library folder?

image

@Thaina
Copy link
Author

Thaina commented Oct 14, 2025

I have test build aab and upload to google play internal track with 6.0.59f2 and there was no error or warning about 16 kb page size at all

@Milan1660
Copy link

Milan1660 commented Oct 15, 2025

native-googlesignin.so is generated build time and added to build. But it generated when I use below configuration code.

GoogleSignIn.Configuration = new GoogleSignInConfiguration() {
            RequestEmail = true,
            RequestProfile = true,
            RequestIdToken = true,
            RequestAuthCode = true,
            // must be web client ID, not android client ID
            WebClientId = "XXXXXXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
#if UNITY_EDITOR || UNITY_STANDALONE
            ClientSecret = "XXXXXX-xxxXXXxxxXXXxxx-xxxxXXXXX" // optional for windows/macos and test in editor
#endif
        };

Now, I am using your same code and scene in new project. With your code native-googlesignin.so is not generated in the build so that's not issue now but I am getting this below error on signin in Android and I am not cancelling or doing anything, when I select account to signin I am just getting this error.

Error - onFailure class androidx.credentials.exceptions.GetCredentialCancellationException : activity is cancelled by the user.

Can you help me with this?

@Thaina
Copy link
Author

Thaina commented Oct 15, 2025

That kind of error seem like a wrong setting in webclientID or fingerprint and keystore file

@Milan1660
Copy link

Now working fine in Android & iOS.

Thank you @Thaina.

Refactor GoogleSignInImplEditor for silentsignin support with cache
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

Successfully merging this pull request may close these issues.