You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -280,6 +280,22 @@ auth0.auth
280
280
.catch(console.error);
281
281
```
282
282
283
+
#### Login using MFA with One Time Password code
284
+
285
+
This call requires the client to have the _MFA_ Client Grant Type enabled. Check [this article](https://auth0.com/docs/clients/client-grant-types) to learn how to enable it.
286
+
287
+
When you sign in to a multifactor authentication enabled connection using the `passwordRealm` method, you receive an error stating that MFA is required for that user along with an `mfa_token` value. Use this value to call `loginWithOTP` and complete the MFA flow passing the One Time Password from the enrolled MFA code generator app.
288
+
289
+
```js
290
+
auth0.auth
291
+
.loginWithOTP({
292
+
mfaToken:error.json.mfa_token,
293
+
otp:'{user entered OTP}',
294
+
})
295
+
.then(console.log)
296
+
.catch(console.error);
297
+
```
298
+
283
299
#### Login with Passwordless
284
300
285
301
Passwordless is a two-step authentication flow that makes use of this type of connection. The **Passwordless OTP** grant is required to be enabled in your Auth0 application beforehand. Check [our guide](https://auth0.com/docs/dashboard/guides/applications/update-grant-types) to learn how to enable it.
exports[`auth OOB flow should handle success with binding code 1`] =`
34
+
Object {
35
+
"accessToken": "1234",
36
+
"expiresIn": 86400,
37
+
"idToken": "id-123",
38
+
"scope": "openid profile email address phone",
39
+
"tokenType": "Bearer",
40
+
}
41
+
`;
42
+
43
+
exports[`auth OOB flow should handle success without binding code 1`] =`
44
+
Object {
45
+
"accessToken": "1234",
46
+
"expiresIn": 86400,
47
+
"idToken": "id-123",
48
+
"scope": "openid profile email address phone",
49
+
"tokenType": "Bearer",
50
+
}
51
+
`;
52
+
53
+
exports[`auth OOB flow should handle unexpected error 1`] =`[a0.response.invalid: Internal Server Error]`;
54
+
55
+
exports[`auth OOB flow should require MFA Token and OOB Code 1`] =`
56
+
"Missing required parameters: [
57
+
\\"mfa_token\\",
58
+
\\"oob_code\\"
59
+
]"
60
+
`;
61
+
62
+
exports[`auth OTP flow should handle unexpected error 1`] =`[a0.response.invalid: Internal Server Error]`;
63
+
64
+
exports[`auth OTP flow should require MFA Token and OTP 1`] =`
65
+
"Missing required parameters: [
66
+
\\"mfa_token\\",
67
+
\\"otp\\"
68
+
]"
69
+
`;
70
+
71
+
exports[`auth OTP flow when MFA is not associated 1`] =`[unsupported_challenge_type: User is not enrolled. You can use /mfa/associate endpoint to enroll the first authenticator.]`;
72
+
73
+
exports[`auth OTP flow when MFA succeeds 1`] =`
74
+
Object {
75
+
"accessToken": "1234",
76
+
"expiresIn": 86400,
77
+
"idToken": "id-123",
78
+
"scope": "openid profile email address phone",
79
+
"tokenType": "Bearer",
80
+
}
81
+
`;
82
+
83
+
exports[`auth OTP flow when OTP Code is invalid 1`] =`[invalid_grant: Invalid otp_code.]`;
84
+
85
+
exports[`auth Recovery Code flow should handle unexpected error 1`] =`[a0.response.invalid: Internal Server Error]`;
86
+
87
+
exports[`auth Recovery Code flow should require MFA Token and Recovery Code 1`] =`
88
+
"Missing required parameters: [
89
+
\\"mfa_token\\",
90
+
\\"recovery_code\\"
91
+
]"
92
+
`;
93
+
94
+
exports[`auth Recovery Code flow when Recovery code succeeds 1`] =`
95
+
Object {
96
+
"accessToken": "1234",
97
+
"expiresIn": 86400,
98
+
"idToken": "id-123",
99
+
"scope": "openid profile email address phone",
100
+
"tokenType": "Bearer",
101
+
}
102
+
`;
103
+
104
+
exports[`auth Recovery Code flow when user does not have Recovery Code 1`] =`[unsupported_challenge_type: User does not have a recovery-code.]`;
105
+
3
106
exports[`auth authorizeUrl should return default authorize url 1`] =`"https://samples.auth0.com/authorize?response_type=code&redirect_uri=https%3A%2F%2Fmysite.com%2Fcallback&state=a_random_state&client_id=A_CLIENT_ID_OF_YOUR_ACCOUNT&auth0Client=eyJuYW1lIjoicmVhY3QtbmF0aXZlLWF1dGgwIiwidmVyc2lvbiI6IjEuMC4wIn0%3D"`;
4
107
5
108
exports[`auth authorizeUrl should return default authorize url with extra parameters 1`] =`"https://samples.auth0.com/authorize?response_type=code&redirect_uri=https%3A%2F%2Fmysite.com%2Fcallback&state=a_random_state&connection=facebook&client_id=A_CLIENT_ID_OF_YOUR_ACCOUNT&auth0Client=eyJuYW1lIjoicmVhY3QtbmF0aXZlLWF1dGgwIiwidmVyc2lvbiI6IjEuMC4wIn0%3D"`;
0 commit comments