From 2c11ef711ee294d841c7682f0dfdae694c57b3cc Mon Sep 17 00:00:00 2001 From: Phebe Sawan Date: Fri, 21 Dec 2018 00:16:17 +0800 Subject: [PATCH] [auth0-js] Add passwordlessLogin to WebAuth for auth0 v9 (#31532) * add passwordlessLogin to WebAuth * remove trailing whitespaces from auth0.WebAuth * Re-arrange the order of the PasswordlessLoginOptions properties to match the declaration in auth0 --- types/auth0-js/auth0-js-tests.ts | 6 ++++++ types/auth0-js/index.d.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index 6d21de4ed3..6353cc1e40 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -136,6 +136,12 @@ webAuth.passwordlessStart({ send: 'code' }, (err, data) => {}); +webAuth.passwordlessLogin({ + connection: 'the_connection', + phoneNumber: '123', + verificationCode: '456' +}, (err, data) => {}); + webAuth.signupAndAuthorize({ connection: 'the_connection', email: 'me@example.com', diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 7ca266e6ce..a38c928333 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -270,6 +270,13 @@ export class WebAuth { */ passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback): void; + /** + * Logs in a user with the verification code sent to the user + * @param options + * @param callback + */ + passwordlessLogin(options: PasswordlessLoginOptions, callback: Auth0Callback): void; + /** * Renews an existing session on Auth0's servers using `response_mode=web_message` (i.e. Auth0's hosted login page) * @@ -615,6 +622,13 @@ export interface PasswordlessVerifyOptions { send?: string; } +export interface PasswordlessLoginOptions { + connection: string; + verificationCode: string; + phoneNumber?: string; + email?: string; +} + export interface Auth0UserProfile { name: string; nickname: string;