简体   繁体   中英

chalice-cognito-auth obtained id_token but still getting "User is not authorized"

Try to use https://pypi.org/project/chalice-cognito-auth/

I was able to get a json response like:

{"id_token":"eyJra...sda",
"refresh_token":"eyJjd...",
"access_token":"eyJraWQiO...",
"token_type":"Bearer"}

But when I try to use it like

curl -H "Authorization: id_token value ..." http://127.0.0.1:8000/whoami

It replied

{
    "Message": "User is not authorized to access this resource"
}

Try this, curl -H "Authorization: Bearer id_token" http://127.0.0.1:8000/whoami

ie, you missed the Bearer keyword.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM