AWS AUTHORIZATION端点重定向到LOGIN端点

时间:2018-05-08 16:36:32

标签: amazon-web-services aws-cognito

在AWS中,我有一个用户池。

  • 该用户池有一个用户。

  • 该用户池有一个App客户端,App Client ID为MY-CLIENT-ID。

  • 该App客户端已启用为cognito用户池的身份提供商,其回调网址为https://MY_APP/redirect_uri,仅在“允许的OAuth流量”和“电子邮件”下选中了“授权代码授权”并在“允许的OAuth范围”下检查“openid”。

  • 该用户池的域名为MY-DOMAIN。

当我导航到

https://MY-DOMAIN.auth.us-east-1.amazoncognito.com/login?
response_type=code&
client_id=MY-CLIENT-ID&
redirect_uri=https://MY_APP/redirect_uri

我被重定向到默认的Cognito登录屏幕,并且可以使用我的用户池用户成功进行身份验证。身份验证后,我被重定向到

https://MY_APP/redirect_uri?code=AUTHORIZATION_CODE

然而,当我(通过浏览器或卷曲)导航到

https://MY-DOMAIN.auth.us-east-1.amazoncognito.com/oauth2/authorize?
response_type=code&
client_id=MY-CLIENT-ID&
redirect_uri=https://MY_APP/redirect_uri

我期待的地方

HTTP/1.1 302 Found
Location: https://MY_APP/redirect_uri?code=AUTHORIZATION_CODE

相反,我正在接收

HTTP/1.1 302 Found
Location: https://MY-DOMAIN.auth.us-east-1.amazoncognito.com/login?
response_type=code&
client_id=MY-CLIENT-ID&
redirect_uri=https://MY_APP/redirect_uri

(显然)将我重定向到登录页面。

我确信我忽视了一些显而易见的事情,但却无法弄清楚它是什么。

参考:https://docs.aws.amazon.com/cognito/latest/developerguide/authorization-endpoint.html

1 个答案:

答案 0 :(得分:0)

您是否期望Cognito提供SSO?显然Cognito不是那样工作的。

据我所知,根据新的身份验证请求,用户确实会被重定向到登录表单。如果用户已经拥有Web会话(cookie),则可以选择继续现有用户会话或重新进行身份验证。

之后(重新验证),用户被重定向到回调redirect_uri

相关问题