【问题标题】:Auth0 unsupported_challenge_type error during 2-factor auth2 因素身份验证期间的 Auth0 unsupported_challenge_type 错误
【发布时间】:2018-05-10 15:39:30
【问题描述】:

我想使用 auth0(用户名/密码和 SMS 代码)实现 2 因素注册。我没有使用 Lock 小部件,而是尝试基于 auth0 API 实现注册。

所以,我现在有以下步骤。

1 注册

POST https://somedomain.eu.auth0.com/dbconnections/signup

{
    "client_id":"MY_CLIENT_ID",
    "client_secret":"MY_CLIENT_SECRET",
    "connection": "Username-Password-Authentication",
    "email": "sowhat@what.what",
    "username": "sowhat",
    "password": "sowhat@what.what",
    "phone_number": "+38...56"  // I have access to this number
}

响应是创建用户。

2 尝试使用用户名/密码登录

POST https://somedomain.eu.auth0.com/oauth/token

{
    "client_id":"MY_CLIENT_ID",
    "client_secret":"MY_CLIENT_SECRET",
    "audience":"http://localhost",
    "email": "sowhat@what.what",
    "username": "sowhat",
    "password": "sowhat@what.what",
    "grant_type":"password"
}

响应是mfa_requiredmfa_token 字符串。

3 请求 mfa 质询

POST https://somedomain.eu.auth0.com/mfa/challenge

{
    "client_id":"MY_CLIENT_ID",
    "client_secret":"MY_CLIENT_SECRET",
    "challenge_type": "oob otp",
    "mfa_token": "MFA_TOKEN_FROM_PREVIOUS_STEP"
}

回复是

{
    "error": "unsupported_challenge_type",
    "error_description": "User is not enrolled with guardian"
}

所以我真的不知道如何解决这个问题。我猜原因可能是因为用户配置文件中缺少 phone_number 但我实际上不知道如何使用Username-Password-Authentication 连接添加它。

【问题讨论】:

    标签: authentication oauth oauth-2.0 auth0 multi-factor-authentication


    【解决方案1】:

    您似乎需要让用户参与“Guardian”。 首先你需要启用 Guardian Factory: 就叫这个: curl -H "Authorization: Bearer %your_token%" -X PUT -H "Content-Type: application/json" -d '{"enabled":true}' "@987654321@"

    现在我们可以让 Guardian 中的用户参与进来:

    1. 创建票证: curl -H "Authorization: Bearer %your_token%" -X POST -H "Content-Type: application/json" -d '{"user_id":"%user_id%"}' "@987654322@"

    2. 在响应中关注ticket_url

    3. 将电话号码输入 opened form

    4. 在您的设备上等待 otp

    5. 将 otp 放入早期打开的形式。

    完成这些步骤后,用户将参与 Guardian。应该可以避免上述问题。

    【讨论】:

    • 感谢您的回复。我的监护人 SMS 因素配置了 twilio 连接(GET /api/v2/guardian/factors 返回[... {name: sms, enabled: true}])。我没有使用 Lock 小部件发送 SMS 的问题(基本上是 ticket_url)。不幸的是,使用 Lock 小部件不符合我们的要求,因为我们只考虑 API 使用,这意味着我不能使用 ticket_url
    猜你喜欢
    • 2018-10-09
    • 2011-03-19
    • 2011-05-02
    • 1970-01-01
    • 2016-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多