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

162 Views Asked by At

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"
}
1

There are 1 best solutions below

1
Incinerator On

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

i.e., you missed the Bearer keyword.