获取 GoogleIdOption

public final class GetGoogleIdOption extends GetCustomCredentialOption


请求检索用户的 Google ID 令牌。

抛出
java.lang.IllegalArgumentException java.lang.IllegalArgumentException

如果 serverClientId 为空

java.lang.IllegalArgumentException java.lang.IllegalArgumentException

如果 filterByAuthorizedAccountsrequestVerifiedPhoneNumber 为 true。

com.google.android.libraries.identity.googleid.GoogleIdTokenParsingException com.google.android.libraries.identity.googleid.GoogleIdTokenParsingException

从软件包创建 GetGoogleIdOption 时遇到任何错误。

总结

嵌套类型

public final class GetGoogleIdOption.Builder

GetGoogleIdOption 的构建器。

public static class GetGoogleIdOption.Companion

公共构造函数

GetGoogleIdOption(
    @NonNull String serverClientId,
    String nonce,
    boolean filterByAuthorizedAccounts,
    String linkedServiceId,
    List<@NonNull String> idTokenDepositionScopes,
    boolean requestVerifiedPhoneNumber,
    boolean autoSelectEnabled
)

公共方法

static final @NonNull GetGoogleIdOption

用于根据给定 Bundle 创建 GetGoogleIdOption 的辅助函数。

final boolean

在请求中设置自动选择行为。

final boolean

仅允许用户从已获得授权来登录您应用的 Google 帐号中进行选择,默认值为 true

final List<@NonNull String>

Google 需要将 Google ID 令牌存入应用的后端服务器的 OAuth 范围。

final String

将帐号与 Google 帐号关联时使用的服务 ID

final String

在生成 ID 令牌期间使用的 Nonce

final boolean

是否要求在注册期间提供经过验证的电话号码。

final @NonNull String

签发 ID 令牌的服务器的客户端 ID

公共构造函数

获取 GoogleIdOption

public GetGoogleIdOption(
    @NonNull String serverClientId,
    String nonce,
    boolean filterByAuthorizedAccounts,
    String linkedServiceId,
    List<@NonNull String> idTokenDepositionScopes,
    boolean requestVerifiedPhoneNumber,
    boolean autoSelectEnabled
)

公共方法

createFrom

public static final @NonNull GetGoogleIdOption createFrom(@NonNull Bundle data)

用于根据给定 Bundle 创建 GetGoogleIdOption 的辅助函数。

参数
@NonNull Bundle data

包含有关 GetGoogleIdOption 的所有必要信息的集合。

getAutoSelectEnabled

public final boolean getAutoSelectEnabled()

在请求中设置自动选择行为。

getFilterByAuthorizedAccounts

public final boolean getFilterByAuthorizedAccounts()

仅允许用户从已获得授权来登录您应用的 Google 帐号中进行选择,默认值为 true

getIdTokenDepositionScopes

public final List<@NonNull StringgetIdTokenDepositionScopes()

Google 需要将 Google ID 令牌存入应用的后端服务器的 OAuth 范围。可选参数,可以设置为 null。仅在 Google 要求特定范围才能存储 ID 令牌时才需要输入。

getLinkedServiceId

public final String getLinkedServiceId()

将帐号与 Google 帐号关联时使用的服务 ID

获取 Nonce

public final String getNonce()

在生成 ID 令牌期间使用的 Nonce

getRequestVerifiedPhoneNumber

public final boolean getRequestVerifiedPhoneNumber()

是否要求在注册期间提供经过验证的电话号码。

getServerClientId

public final @NonNull String getServerClientId()

签发 ID 令牌的服务器的客户端 ID