问题描述
我正在尝试在 Web 应用程序中使用 Okta API,以允许用户激活/停用其帐户中的 SMS MFA 因素.但是,我遇到了一个问题,详情如下:
I'm attempting to use the Okta API in a web application to allow users to activate/deactivate a SMS MFA factor on their accounts. However, I'm running into an issue as detailed below:
首先,在新创建的帐户上:
First, on a newly created account:
- 通过注册注册短信因素Okta SMS Factor API 方法.
- 此因素随后通过激活短信因素激活 API方法.
- 然后我们使用 重置因子 API一>方法.
- An SMS factor is enrolled via the Enroll Okta SMS Factor API method.
- This factor is subsequently activated via the Acivate SMS Factor APImethod.
- Then we deactivate the factor using the Reset Factor APImethod.
所有这些都可以正常工作并且没有错误,但是,现在尝试再次注册 SMS 因素时:
All of this works fine and without errors, however, now when trying to enroll a SMS factor again:
- 如果使用相同的电话号码:不会发送安全代码和短信无需验证即可启用双因素身份验证(这还可以,但出乎意料)
如果使用不同的电话号码:Okta 返回以下错误对象:
- If using the same phone number: No security code will be sent and SMStwo-factor auth will be enabled without requiring verification (thisis okay but unexpected)
If using a different phone number: Okta returns the following error object:
stdClass Object
(
[errorCode] => E0000001
[errorSummary] => Api validation failed: factorEnrollRequest
[errorLink] => E0000001
[errorId] => oae3MBJJpGrR6Oj_MkGOxed_g
[errorCauses] => Array
(
[0] => stdClass Object
(
[errorSummary] => There is an existing verified phone number.
)
)
)
我该如何解决这个问题?我是否遗漏了必须删除以前验证过的电话号码的步骤?如果是这样,我该怎么做?
How can I resolve this issue? Am I missing a step where I have to remove a previously verified phone number? If so, how do I do that?
推荐答案
此端点的更新方法没有记录,但可以执行.
The update method for this endpoint isn't documented but it can be performed.
如果您之前删除了 SMS,我不知道如何恢复该过程,并且不知道之前注册的电话号码.
I do not know how to recover the process if you have previously removed SMS and do not know the previously registered phone number.
除此之外,如果您要更改号码,请执行以下操作.
Outside of that scenario, if you are changing a number do the following.
- 获取完整的因素列表
- 确定要更改的 SMS 因素(我们需要 fid)
使用现有短信的因子 ID 和新电话号码
- Get the full list of factors
- Identify the SMS factor to be changed (we need the fid)
Using the factor id of the existing SMS and the new phone number
POST https://{yourorg}.com/api/v1/users/{:uid}/factors/{:fid}
{
"profile":
{
"phoneNumber": "+1 555 123 1234"
}
}
响应将与 新注册短信因素
如果您遇到重置前一个因素并且您不知道 fid 但知道数字的情况,您可以 注册号码,检索该 fid,然后开始上述序列.
If you run into a situation where the previous factor was reset and you don't know the fid but do know the number you can enroll the number, retrieve that fid and then begin the sequence described above.
这篇关于Okta API:短信多因素问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!