登录 Google 选项

public final class GetSignInWithGoogleOption extends GetCustomCredentialOption


明确检索“使用 Google 帐号登录”按钮检索用户的 Google ID 令牌的请求。

希望提供此凭据类型的凭据提供程序必须检查传入的 GetCustomCredentialOption 是否为 GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_CREDENTIAL 类型,并且相应的 requestDatacandidateQueryData 必须具有 GoogleIdTokenCredential.BUNDLE_KEY_GOOGLE_ID_TOKEN_SUBTYPE 键,并且值设置为 GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_SIWG_CREDENTIAL

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

如果 serverClientId 为空

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

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

总结

嵌套类型

GetSignInWithGoogleOption 的 Builder 类

公共构造函数

GetSignInWithGoogleOption(
    @NonNull String serverClientId,
    String hostedDomainFilter,
    String nonce
)

公共方法

static final @NonNull GetSignInWithGoogleOption

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

final String

托管的域名过滤条件(例如 myuniveristy.edu)

final String

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

final @NonNull String

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

公共构造函数

登录 Google 选项

public GetSignInWithGoogleOption(
    @NonNull String serverClientId,
    String hostedDomainFilter,
    String nonce
)

公共方法

createFrom

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

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

参数
@NonNull Bundle data

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

getHostedDomainFilter

public final String getHostedDomainFilter()

托管的域名过滤条件(例如 myuniveristy.edu)

获取 Nonce

public final String getNonce()

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

getServerClientId

public final @NonNull String getServerClientId()

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