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

Sample for Credential Manager with Sign in with Google #53

Open
yschimke opened this issue Oct 24, 2023 · 16 comments
Open

Sample for Credential Manager with Sign in with Google #53

yschimke opened this issue Oct 24, 2023 · 16 comments
Assignees

Comments

@yschimke
Copy link

Is there a sample planned for Credential Manager with Sign in with Google?

https://developer.android.com/training/sign-in/credential-manager

We struggled with it, found a fix, but unclear if it's a fix for all situations?

@yschimke
Copy link
Author

Fix joreilly/Confetti#955

@niharika2810
Copy link
Contributor

Yes, we are working on this. Thank you for sharing this, we are looking into it.,

@niharika2810
Copy link
Contributor

Hey wanted to ask iof you have tried this :

.setFilterByAuthorizedAccounts(true)

check the documentation here : https://developer.android.com/training/sign-in/credential-manager

You should first call the API with the setFilterByAuthorizedAccounts parameter set to true. If there are no credentials available, then call the API again and set setFilterByAuthorizedAccounts to false.

Let me know

@yschimke
Copy link
Author

I'll try that.

The fix changed us from com.google.android.libraries.identity.googleid.GetGoogleIdOption to GetSignInWithGoogleOption

https://github.com/joreilly/Confetti/pull/955/files#diff-cfa8e621122eb59ae9c24cfa7447d7cc82106e1bada94b0ef4973fb1ff2cac6a

Should we revert back to GetGoogleIdOption which is used in that sample?

val googleIdOption: GetGoogleIdOption = GetGoogleIdOption.Builder()
  .setFilterByAuthorizedAccounts(true)
  .setServerClientId(SERVER_CLIENT_ID)
  .build()

@niharika2810
Copy link
Contributor

yeah i think the official documentation has the latest methods and code. Also, the the error you got is NoCredentialException which is expected, given the non authorized account has been filterd by setting the "setFilterByAuthorizedAccounts" to true.

@yschimke
Copy link
Author

Thanks, that all makes sense.

Is there a reason to prefer one or the other Button vs non-button?

@nick-sasquatch
Copy link

I'm struggling with this as well--I'd expect that setting setFilterByAuthorizedAccounts(true) would throw the NoCredentialException, but when I set that to false, I'm getting the same result. I tried the same thing with the GetSignInWithGoogleOption, and the view with all of the accounts I'd expect showed up, but when selecting one, no credential was returned.

Maybe I'm not understanding the flow, but it doesn't seem like I'd need to run through the email/password flow to create an account if there's an existing set of credentials on my device. Can you point me to documentation/an example on how this workflow should work? Thanks! (I'm also happy to put this into a new issue or ask elsewhere if that's the best approach.)

@Freshm4at
Copy link

Freshm4at commented Mar 12, 2024

@nick-sasquatch I've exact same problem.
When i try with GetGoogleIdOption, error is no credential
When i try with GetSignInWithGoogleOption, error is GetCredentialCustomException: Account authorization failed

Maybe the ServerClientId, but i don't think so, I had copy/paste from google Cloud Console. Also I added a google account on the emulator, but it changes nothing for the problem.

Some help? I found nothing on web.
Thank's!

@Wraiyth
Copy link

Wraiyth commented Mar 12, 2024

@Freshm4at We are having the exact same issue as you as well. If we use GetSignInWithGoogleOption, we get the same Account authorization failed exception.
At this stage it seems better to just use the old sign-in methods even though they are deprecated?

@nick-sasquatch
Copy link

@Freshm4at For me, the issue was in my firebase configuration--there are a couple ways to specify your app's SHA fingerprint: SHA-1 and SHA-256, and I only had the SHA-256 set. Turns out you need the SHA-1 no matter what. Hope you get this sorted soon!

@Wraiyth
Copy link

Wraiyth commented Mar 13, 2024

@nick-sasquatch This was sort of my issue as well - in my case it was the incorrect SHA1 in the Android project that was created directly in Google Cloud, but now I'm getting an error "Unable to get token". Did you experience this at all?

@nick-sasquatch
Copy link

@Wraiyth Sorry, I didn't experience that error.

@freehussain
Copy link

i have the same issue here

@niharika2810
Copy link
Contributor

Let me check this and get back to you.

@ipyton
Copy link

ipyton commented Apr 29, 2024

Yes, I guess a more details needed. For example, I don't know how to allow user to add a new account when a google account do not exist on the device. And there are so many old version examples may misguide the developers. Thank you!

@niharika2810
Copy link
Contributor

@ksemenova Could you please check this one?

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