获取401未授权:身份验证失败:无法在okta Web应用程序中获取访问令牌

时间:2018-04-13 14:18:34

标签: jhipster okta

我创建了一个jhipster单片应用程序(jhipster版本v4.14.2)。我还创建了一个具有以下设置的Okta Web应用程序:

我更新了我的jhipster应用程序的application.yaml,如下所示:

security:
    basic:
        enabled: false
    oauth2:
        client:
            access-token-uri: https://dev-779125.oktapreview.com/oauth2/default/v1/token
            user-authorization-uri: https://dev-779125.oktapreview.com/oauth2/default/v1/authorize
            client-id: ????????
            client-secret: ????????
            client-authentication-scheme: form
            scope: openid profile email
        resource:
            filter-order: 3
            user-info-uri: https://dev-779125.oktapreview.com/oauth2/default/v1/userinfo
            token-info-uri: https://dev-779125.oktapreview.com/oauth2/default/v1/introspect
            prefer-token-info: false

当我启动应用程序然后尝试登录时。我确实获得了Okta登录页面,但是在添加我的凭据后,我总是收到以下错误:

Your request cannot be processed
Sorry, an error has occurred.

Status: Unauthorized (Unauthorized)
Message: Authentication Failed: Could not obtain access token

我遵循了jhipster安全文档中的指令,无法使其正常工作。知道为什么我仍然会收到未经授权的错误吗?

1 个答案:

答案 0 :(得分:0)

这可能与jhipster无关。确保您访问访问令牌的URL正确无误。

您使用什么格兰特类型?

https://developer.okta.com/authentication-guide/implementing-authentication/

我认为错误就在这里:

access-token-uri:https://dev-779125.oktapreview.com/oauth2/default/v1/token             user-authorization-uri:https://dev-779125.oktapreview.com/oauth2/default/v1/authorize

请求“发行人URL”的“user-authorization-uri”jhipster方式?