跳到主要内容

FedCm🧪

该域允许与FedCM对话框进行交互。

EN
This domain allows interacting with the FedCM dialog.

✅️️ Methods

🔨FedCm.clickDialogButton

参数必填标记类型描述原文
dialogId✔️string
dialogButton✔️DialogButton

🔨FedCm.disable


🔨FedCm.dismissDialog

参数必填标记类型描述原文
dialogId✔️string
triggerCooldownboolean

🔨FedCm.enable

参数必填标记类型描述原文
disableRejectionDelayboolean允许调用者禁用通常会发生Promise拒绝延迟,如果这对正在测试的内容不重要。(https://fedidcg.github.io/FedCM/#browser-api-rp-sign-in 的第4步)
ENAllows callers to disable the promise rejection delay that would normally happen, if this is unimportant to what's being tested. (step 4 of https://fedidcg.github.io/FedCM/#browser-api-rp-sign-in)

🔨FedCm.openUrl

参数必填标记类型描述原文
dialogId✔️string
accountIndex✔️integer
accountUrlType✔️AccountUrlType

🔨FedCm.resetCooldown

重置冷却时间(如果存在),以允许下一次FedCM调用显示对话框,即使用户最近刚刚关闭了一个对话框。

EN
Resets the cooldown time, if any, to allow the next FedCM call to show a dialog even if one was recently dismissed by the user.

🔨FedCm.selectAccount

参数必填标记类型描述原文
dialogId✔️string
accountIndex✔️integer

✅️️ Events

👋FedCm.dialogClosed

当对话框被关闭时触发,无论是通过用户操作、JS 中止还是以下命令。

EN
Triggered when a dialog is closed, either by user action, JS abort, or a command below.
参数必填标记类型描述原文
dialogId✔️string

👋FedCm.dialogShown

参数必填标记类型描述原文
dialogId✔️string
dialogType✔️DialogType
accounts✔️array[Account]
title✔️string这些存在主要是为了让调用者能够验证RP上下文是否被恰当使用。
ENThese exist primarily so that the caller can verify the RP context was used appropriately.
subtitlestring

✅️️ Types

📌FedCm.Account

对应 IdentityRequestAccount

EN
Corresponds to IdentityRequestAccount

返回类型:object

属性必填标记类型描述原文
accountId✔️string
email✔️string
name✔️string
givenName✔️string
pictureUrl✔️string
idpConfigUrl✔️string
idpLoginUrl✔️string
loginState✔️LoginState
termsOfServiceUrlstring这两个仅在登录状态为注册时设置
ENThese two are only set if the loginState is signUp
privacyPolicyUrlstring

📌FedCm.AccountUrlType

每个账户拥有的URL
允许的值:TermsOfServicePrivacyPolicy

EN
The URLs that each account has
Allowed Values: TermsOfService, PrivacyPolicy

返回类型:string


📌FedCm.DialogButton

FedCM对话框上的按钮。
允许的值:ConfirmIdpLoginContinueErrorGotItErrorMoreDetails

EN
The buttons on the FedCM dialog.
Allowed Values: ConfirmIdpLoginContinue, ErrorGotIt, ErrorMoreDetails

返回类型:string


📌FedCm.DialogType

FedCM对话框的类型。
允许的值:AccountChooserAutoReauthnConfirmIdpLoginError

EN
The types of FedCM dialogs.
Allowed Values: AccountChooser, AutoReauthn, ConfirmIdpLogin, Error

返回类型:string


📌FedCm.LoginState

这是该账户的注册还是登录操作,即该账户之前是否曾用于登录此RP。
允许的值:SignInSignUp

EN
Whether this is a sign-up or sign-in action for this account, i.e. whether this account has ever been used to sign in to this RP before.
Allowed Values: SignIn, SignUp

返回类型:string