get method

The get() method of the CredentialsContainer interface returns a Promise that fulfills with a single credential instance that matches the provided parameters, which the browser can then use to authenticate with a relying party. This is used by several different credential-related APIs with significantly different purposes:

  • The Credential Management API uses get() to authenticate using basic federated credentials or username/password credentials.
  • The Web Authentication API uses get() to authenticate or provide additional factors during MFA with public key credentials (based on asymmetric cryptography).
  • The Federated Credential Management (FedCM) API uses get() to authenticate with federated identity providers (IdPs).
  • The WebOTP API uses get() to request retrieval of a one-time password (OTP) from a specially-formatted SMS message sent by an app server.

The below reference page starts with a syntax section that explains the general method call structure and parameters that apply to all the different APIs. After that, it is split into separate sections providing parameters, return values, and examples specific to each API.

Implementation

external JSPromise<Credential?> get([CredentialRequestOptions options]);