IdentityCredentialRequestOptions
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The IdentityCredentialRequestOptions
dictionary represents the object passed to CredentialsContainer.get()
as the value of the identity
option.
When an identity
option is provided in a get()
call made on a relying party (RP) website, the user is offered a list of federated identity providers (IdPs) as sign-in options. Once the user signs in successfully using one of these options, the promise returned by the get()
call returns an IdentityCredential
object.
Instance properties
context
Optional-
A string specifying the context in which the user is authenticating with FedCM. The browser uses this value to vary the text in its FedCM UI to better suit the context. Possible values are:
"continue"
-
Suitable for situations where the user is choosing an identity to continue to the next page in the flow, which requires a sign-in. Browsers will provide a text string similar to:
Continue to <page-origin> with <IdP>
"signin"
-
Suitable for general situations where the user is signing in with an IdP account they've already used on this origin. Browsers will provide a text string similar to:
Sign in to <page-origin> with <IdP>
"signup"
-
An option for situations where the user is signing in to the origin with a new IdP account they've not used here before. Browsers will provide a text string similar to:
Sign up to <page-origin> with <IdP>
"use"
-
Suitable for situations where a different action, such as validating a payment, is being performed. Browsers will provide a text string similar to:
Use <page-origin> with <IdP>
The default value is
"signin"
. mode
Optional-
A string specifying the UI mode to use for the sign-in flow. Possible values are:
active
-
The sign-in flow must be initiated via a user action such as clicking a button. If
mode
is set toactive
,providers
can only have a length of1
, otherwise theget()
promise will reject. passive
-
The sign-in flow can be initiated without direct user interaction. This is the default value.
See Active versus passive mode for more details of the difference between the two modes.
providers
-
An array of objects specifying details of the IdPs that the user should be presented with as options for signing in. These objects can contain the following properties:
configURL
-
A string specifying the URL of the IdP's config file. See Provide a config file for more information.
clientId
-
A string specifying the RP client identifier. This information is issued by the IdP to the RP in a separate process that is specific to the IdP.
domainHint
Optional-
A string hinting at the domain of accounts that the RP is interested in. If provided, the user agent will only show accounts that match the domain hint value in their
domain_hints
array. If"any"
is specified, the RP will show any account that is associated with at least one domain hint. fields
Optional-
An array of strings specifying user information that the RP wishes to obtain from the IdP for use in the sign-in process. The exact strings will vary by IdP, but tend to be similar to
"name"
,"email"
, or"profile-picture-url"
. loginHint
Optional-
A string providing a hint about the account option(s) the browser should provide for the user to sign in with. This is useful in cases where the user has already signed in and the site asks them to reauthenticate. Otherwise, the reauthentication process can be confusing when a user has multiple accounts and can't remember which one they used to sign in previously. The value for the
loginHint
property can be taken from the user's previous sign-in, and is matched against thelogin_hints
values provided by the IdP in the array of user information returned from the IdP's accounts list endpoint. nonce
Optional-
A random string that can be included to ensure the response is issued specifically for this request and prevent replay attacks.
params
Optional-
A custom object used to specify any additional key-value parameters that RP needs to send to the IdP. This will vary by IdP and could include, for example, additional permission requests such as
admin: true
, orcalendar: "readonly"
.
Specifications
Specification |
---|
Federated Credential Management API> # dictdef-identitycredentialrequestoptions> |
Browser compatibility
Loading…