从 AWS Cognito 托管界面的重定向中查找已注册用户

huangapple go评论47阅读模式
英文:

Find Signed up User from redirect of AWS Cognito Hosted UI

问题

我想知道哪个用户在我的Cognito托管UI上注册了。
根据AWS文档的配置,一切都正常。
打开UI后,它能正常工作。
但是,一旦重定向到我的网站,它会附加一个类似这样的UUID代码:
https://example.com/signup?code=140ac1a7-aaaa-bbbb-cccc-180bcb7c55f0

但似乎提供的代码与刚刚创建的用户无关。
我漏掉了什么地方?

附加信息:我正在使用Java后端开发,因此无法使用JS SDK。
我尝试将response_type更改为token而不是code,但然后托管UI会将我重定向到:
https://example.com/signup?#error_description=unauthorized_client&error=invalid_request

英文:

I want to know which user has signed up on my Cognito hosted UI.
I configured everything accordingly to the AWS documentation.

When opened, the UI works just fine.
As soon as it comes to the redirect to my website it appends a UUID code like this:

https://example.com/signup?code=140ac1a7-aaaa-bbbb-cccc-180bcb7c55f0

But it seems that the given code has nothing in common with the user that was just created.
Where am I missing something?

Additional info: I'm working on a java backend, so I cannot use the JS SDK

I tried to change the response_type to token instead of code but then the hosted UI redirects me to:

https://example.com/signup?#error_description=unauthorized_client&error=invalid_request

答案1

得分: 0

UUID是访问代码。 使用它,您可以获取访问令牌,该令牌可以提供用户信息。

文档可以在此处找到:
https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html

而请求如下所示:

POST https://your-pool.auth.your-region.amazoncognito.com/oauth2/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
client_id=your-code&
code=the-access-code&
redirect_uri=your-redirect

英文:

The UUID is the access code. With it u can get the access token which can provide you with the user information.
The documentation can be found here:
https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html

And the request looks like this:

POST https://your-pool.auth.your-region.amazoncognito.com/oauth2/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
client_id=your-code&
code=the-access-code&
redirect_uri=your-redirect

huangapple
  • 本文由 发表于 2023年2月8日 17:13:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75383482.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定