我正在创建一个用于 IdentityServer 3 的测试应用程序,并使用 AngularJs、Angular Ui Router 和 oauth-ng 库来创建它。我的应用程序需要在客户端使用 OpenID 连接授权代码流。所以我对 oauth-ng 库做了相当小的更改。
我的测试应用程序成功连接到 IdentityServer3 并获取身份验证代码和状态。但是当服务器重定向到重定向 url 时,我收到 404 错误。以下消息
但是 URL 中包含授权代码和状态。这是我编写的一些代码。
login.html - 登录 View
<oauth
site="https://localhost:44333/core"
client-id="codeclient"
response-type="code" // <= added this attribute
redirect-uri="http://localhost:4443/redirect"
scope="openid profile email">
</oauth>
IdentityServer 中的重定向 URL 已正确配置。以下是IdentityServer3返回的url
但是出现了上面的错误。 Firefox 浏览器在控制台上出现错误,指出 Mixtype Error
,建议我从 HTTP 切换到 HTTPS。我也尝试过以下 python script但这也不起作用。有人可以帮忙吗?
最佳答案
您必须设置正确的授权路径。检查我的设置
<oauth
site="https://localhost:44333"
client-id="angular-client-id"
redirect-uri="http://localhost:9000"
authorize-path="/connect/authorize"
response-type="id_token token"
nonce="value"
scope="openid profile {your resource scope}" style="width: 50%">
关于javascript - 使用 AngulrJs 和 Angular Ui 路由器从 IdentityServer3 重定向时出现错误响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29813707/