79254245

Date: 2024-12-05 10:27:46
Score: 1.5
Natty:
Report link

@AliNaddaf The Google docs seems misleading. It reads: "If no authorized Google Accounts are available, the user should be prompted to sign up with any of their available accounts. To do this, prompt the user by calling the API again and setting setFilterByAuthorizedAccounts to false. Learn more about sign up."

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

So if I understand your reply to Mustafiz012 on 27 Aug correctly, you are saying it is not possible for GetCredentialRequest to generate the UI for users to create a Google account for devices that have NO Google account? The only way is to use something like this?

fun getAddGoogleAccountIntent(): Intent {
val intent = Intent(Settings.ACTION_ADD_ACCOUNT)
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, arrayOf("com.google"))
return intent

}

I wonder why Google did not release some sample codes for Sign In with Google using Credential Manager.

From your detailed explanation on the different scenarios, it seems the difference setting setFilterByAuthorizedAccounts to true or false only matters for existing Google accounts and does not apply at all to non existing Google accounts and hence Credential Manager is not providing any means to add Google account. If so, it will be good to clarify this in the docs.

Although I will assume many devices will have Google accounts, as a developer I need to cater to all possible scenarios.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @AliNaddaf
  • Low reputation (1):
Posted by: chan fook sheng