双因素身份验证
启用双因素身份验证
POST /user/two-factor-authentication
axios.post(`/user/two-factor-authentication`).then(() => {
// 成功
}).catch(error => {
// 失败
});
GET /user/two-factor-secret-key
GET /user/two-factor-qr-code
确认双因素身份验证
POST /user/confirmed-two-factor-authentication
axios.post(`/user/confirmed-two-factor-authentication`, {
code: '123456'
}).then(() => {
// 成功
}).catch(error => {
// 谷歌验证码不正确...
});
显示恢复代码
GET /user/two-factor-recovery-codes
axios.post(`/user/two-factor-recovery-codes`).then(response => {
console.log(response);
});
重新生成恢复代码
POST /user/two-factor-recovery-codes
axios.post(`/user/two-factor-recovery-codes`).then(response => {
console.log(response);
});
使用两因素身份验证进行身份验证
POST /two-factor-challenge
通过谷歌验证码
axios.post(`/two-factor-challenge`, {
code: '123456'
}).then(() => {
// 成功
}).catch(error => {
// 谷歌验证码不正确...
});
通过恢复代码
axios.post(`/two-factor-challenge`, {
recovery_code: 'ABCDEFG'
}).then(() => {
// 成功
}).catch(error => {
// 恢复代码不正确...
});
禁用双因素身份验证
DELETE /user/two-factor-authentication
axios.delete(`/user/two-factor-authentication`).then(() => {
// 成功
}).catch(error => {
// 失败
});
