Class IdentityCredential
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalIdentityCredential interface of the Federated Credential Management API (FedCM) represents a user identity credential arising from a successful federated sign-in.
[Value("IdentityCredential")]
public class IdentityCredential : Credential
- Inheritance
-
IdentityCredential
- Inherited Members
Remarks
A successful Get(CredentialRequestOptions) call that includes an identity option fulfills with an IdentityCredential instance.
Constructors
IdentityCredential()
public IdentityCredential()
Properties
IsAutoSelected
NOTE
ExperimentalisAutoSelected read-only property of the IdentityCredential interface indicates whether the federated sign-in flow was carried out using auto-reauthentication (i.e., without user mediation) or not.
[Value("isAutoSelected")]
public bool IsAutoSelected { get; }
Property Value
- bool
A boolean value.
trueindicates that automatic reauthentication was used;falseindicates that it was not.
Remarks
Automatic reauthentication can occur when a Get(CredentialRequestOptions) call is issued with a mediation option value of "optional" or "silent". It is useful for a Relying party (RP) to know whether auto reauthentication occurred for analytics/performance evaluation and for UX purposes — automatic sign-in may warrant a different UI flow to non-automatic sign-in.
Token
NOTE
Experimentaltoken read-only property of the IdentityCredential interface returns the token used to validate the associated sign-in.
[Value("token")]
public string? Token { get; }
Property Value
- string
A string.
Remarks
The token includes user identity information that has been signed with the Identity provider's digital certificate.
The Relying party (RP) sends the token to its server to validate the certificate, and on success can use the (now trusted) identity information in the token to sign them into their service (starting a new session), sign them up to their service if they are a new user, etc.
If the user has never signed into the IdP or is logged out, the associated Get(CredentialRequestOptions) call rejects with an error and the RP can direct the user to the IdP login page to sign in or create an account.
NOTE
The exact structure and content of the validation token is opaque to the FedCM API, and to the browser. The IdP decides on the syntax and usage of it, and the RP needs to follow the instructions provided by the IdP (see Verify the Google ID token on your server side, for example) to make sure they are using it correctly.
Methods
Disconnect(IdentityCredentialDisconnectOptions)
NOTE
Experimentaldisconnect() static method of the IdentityCredential interface disconnects a specified federated sign-in account from the {{glossary("Identity provider", "IdP")}} used to obtain the credential.
[Value("disconnect")]
public static Task<GlobalObject.Undefined> Disconnect(IdentityCredentialDisconnectOptions options = null)
Parameters
Returns
- Task<GlobalObject.Undefined>
A Promise that fulfills with GlobalObject.Undefined.
Remarks
Afterwards, using that account for federated login requires starting the federated sign-in process again.
-Federated Credential Management API on privacysandbox.google.com (2023)