Back to Node Auth0

Class Passwordless

docs/classes/auth.Passwordless.html

5.9.16.7 KB
Original Source

Class Passwordless

Handles passwordless flows using Email and SMS.

Hierarchy (View Summary)

Index

Constructors

constructor

Methods

sendEmailsendSMSloginWithEmailloginWithSMSrequest

Properties

domainclientIdclientSecret?clientAssertionSigningKey?clientAssertionSigningAlg?useMTLS?configuration

Constructors

constructor

new Passwordless(configuration: AuthenticationClientOptions): Passwordless

Parameters

Returns Passwordless

Methods

sendEmail

sendEmail(
bodyParameters: SendEmailRequest,
initOverrides?: InitOverride,
): Promise<VoidApiResponse>

Start passwordless flow sending an email.

Given the user email address, it will send an email with:

  • A link (default, send:"link"). You can then authenticate with this user opening the link and he will be automatically logged in to the application. Optionally, you can append/override parameters to the link (like scope, redirect_uri, protocol, response_type, etc.) using authParams object.
  • A verification code (send:"code"). You can then authenticate with this user using the /oauth/token endpoint specifying email as username and code as password.

See: https://auth0.com/docs/api/authentication#get-code-or-link

Parameters

Returns Promise<VoidApiResponse>

Example

const auth0 = new AuthenticationApi({ domain: 'my-domain.auth0.com', clientId: 'myClientId', clientSecret: 'myClientSecret'});await auth0.passwordless.sendEmail({ email: '{EMAIL}', send: 'link', authParams: {} // Optional auth params.});Copy

sendSMS

sendSMS(
bodyParameters: SendSmsRequest,
initOverrides?: InitOverride,
): Promise<VoidApiResponse>

Start passwordless flow sending an SMS.

Given the user phone_number, it will send a SMS message with a verification code. You can then authenticate with this user using the /oauth/token endpoint specifying phone_number as username and code as password:

See: https://auth0.com/docs/api/authentication#get-code-or-link

Parameters

Returns Promise<VoidApiResponse>

Example

const auth0 = new AuthenticationApi({ domain: 'my-domain.auth0.com', clientId: 'myClientId', clientSecret: 'myClientSecret'});await auth0.passwordless.sendSMS({ phone_number: '{PHONE}'});Copy

loginWithEmail

loginWithEmail(
bodyParameters: LoginWithEmailRequest,
options?: GrantOptions,
): Promise<JSONApiResponse<TokenSet>>

Once you have a verification code, use this endpoint to login the user with their email and verification code.

Parameters

Returns Promise<JSONApiResponse<TokenSet>>

Example

const auth0 = new AuthenticationApi({ domain: 'my-domain.auth0.com', clientId: 'myClientId', clientSecret: 'myClientSecret'});await auth0.passwordless.loginWithEmail({ email: '[email protected]', code: 'ABC123'});Copy

loginWithSMS

loginWithSMS(
bodyParameters: LoginWithSMSRequest,
options?: GrantOptions,
): Promise<JSONApiResponse<TokenSet>>

Once you have a verification code, use this endpoint to login the user with their phone number and verification code.

Parameters

Returns Promise<JSONApiResponse<TokenSet>>

Example

const auth0 = new AuthenticationApi({ domain: 'my-domain.auth0.com', clientId: 'myClientId', clientSecret: 'myClientSecret'});await auth0.passwordless.loginWithSMS({ phone_number: '0777777777', code: 'ABC123'});Copy

Protectedrequest

request(
context: RequestOpts,
initOverrides?: RequestInit | InitOverrideFunction,
): Promise<Response>

Parameters

Returns Promise<Response>

Properties

domain

domain: string

clientId

clientId: string

OptionalclientSecret

clientSecret?: string

OptionalclientAssertionSigningKey

clientAssertionSigningKey?: string

OptionalclientAssertionSigningAlg

clientAssertionSigningAlg?: string

OptionaluseMTLS

useMTLS?: boolean

Protectedconfiguration

configuration: Configuration

Settings

Member Visibility

  • Protected
  • Inherited

ThemeOSLightDark

On This Page

Constructors constructor Methods sendEmailsendSMSloginWithEmailloginWithSMSrequest Properties domainclientIdclientSecretclientAssertionSigningKeyclientAssertionSigningAlguseMTLSconfiguration