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

Recent migration attempt #256

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

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",
}

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
@nixonjoshua98
Copy link

nixonjoshua98 commented Jul 12, 2024

GoogleSignIn.Configuration ??= new GoogleSignInConfiguration()
{
    WebClientId = Env.GoogleWebClientId,
    RequestIdToken = true,
    UseGameSignIn = false,
    RequestEmail = true,
    HidePopups = true
};

var user = await DefaultInstance.SignInSilentlyAsync();
  1. Dismissing the popup may sometimes prompt the following
    image

  2. The prompt is always shown, there is no 'silently' sign in. I cant see how to fix this

@Thaina
Copy link
Author

Thaina commented Jul 13, 2024

@nixonjoshua98 I have push the new fix to allow auto signin for device with multiple account. But I just have found some detailed concern about this case

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

As there is mention about criteria to auto signin. Even we have auto signin for the device with multiple account, if there is also more than one account had ever signin to your app, the account selector will still be launched anyway in the same manner you have experienced

The stackoverflow answer above have mention that you might need to revoke access to the app from the account too, and have only one account connect to the app

I have just create google issue for request a feature to specified email hint (as the new identity signin system was not contain API to set a hint anymore). Would you pleased to upvote this issue too?

https://issuetracker.google.com/issues/352864317

@nixonjoshua98
Copy link

Much love, I've upvoted it. Thanks for the quick responses

@nivedhKA
Copy link

Is there any update on 'silently' sign in ? @Thaina @nixonjoshua98

@nixonjoshua98
Copy link

I went with the approach of storing an encrypted token after signing in, which stores your login preference. Let's me skip the Google login popup, and I just send that token to my backend.

@Thaina
Copy link
Author

Thaina commented Jul 23, 2024

Is there any update on 'silently' sign in ? @Thaina @nixonjoshua98

It should be silent if you have only one account signing in into your app in your device, isn't it?

@nivedhKA
Copy link

nivedhKA commented Jul 23, 2024

Yes, it's working and doesn't open dialog ui of account selecting but still encounter the following error in the logs during a slientlysignin :

NoCredentialException: During begin sign-in, failure response from one tap: 16: User disabled the feature

Upon researching this error, I discovered that it occurs when the Google account's sign-in prompt is disabled. Specifically, if a user has only one account signed in and has disabled the one-tap sign-in feature in their Google account settings, this error is generated. When I enabled the one-tap sign-in for the affected Google account, the error disappeared. However, the account selection dialog appears again.

Steps to Reproduce

  1. Ensure only one Google account is signed into the device.
  2. Disable the one-tap sign-in feature for this Google account in its settings.
  3. Attempt to sign in silently using the app.
  4. Observe the NoCredentialException error in the logs.
  5. Enable the one-tap sign-in feature for the Google account.

rEhN8flk

  1. Attempt to sign in silently again and notice that the account selection dialog appears once more.

@Thaina
Copy link
Author

Thaina commented Jul 23, 2024

Based on your step, isn't those expected behaviour? Or are there other behaviour we should have?

@nixonjoshua98
Copy link

@nivedhKA Where is that setting, i can't seem to find it? I have this exception for a couple of users as well.

@nivedhKA
Copy link

@nivedhKA Where is that setting, i can't seem to find it? I have this exception for a couple of users as well.

In Android Device -> Open Settings -> Find Google Account -> Select Google Account And Select -> Open Manage Account And Search Sign In prompts.

@Thaina
Copy link
Author

Thaina commented Aug 9, 2024

@nivedhKA I think I just understand your issue

I think what you trying to do, which is disabling signinprompt, are not given what you expected

What I think it would is revoking the signin of the app from all of your accounts except one, which is difference thing from just disabling signin prompt

I am not testing it yet but maybe this might work

image

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.

6 participants