django 使用aws cognito UserInfo端点

jum4pzuy  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(128)

我正在尝试从我的django rest framework后端服务器调用这个User端点。https://docs.aws.amazon.com/cognito/latest/developerguide/userinfo-endpoint.html
根据文档,我需要使用授权承载令牌发出GET请求。所以从我的后端,我尝试了:
''' requests.get('https://cognito-idp.us-east-2.amazonaws.com/oauth2/userInfo',headers='Authorization':'Bearer '+str(request.auth)[2:-1]})'''
最后的拼接只是从django rest framework的request.auth.中去掉访问令牌周围的B'和'。
我什么也没得到,或者得到了一个400错误的请求,但不是文档中说我应该得到的那个请求。
我也试过从 Postman 以各种方式。Here's one of them
任何关于此请求的正确格式的帮助将不胜感激!谢谢.

nlejzf6q

nlejzf6q1#

您需要使用您的用户池域:
https://{{user_pool_domain}}.auth.{{region}}.amazoncognito.com/oauth2/userinfo

相关问题