gridsmartercities / aws-lambda-decorators

A set of Python decorators to simplify AWS lambda development
MIT License
22 stars 6 forks source link

[JWT] Authorization: Bearer <token> support? #124

Open kwiwon opened 3 years ago

kwiwon commented 3 years ago

When I try to use the standard JWT header: "Authorization":"bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9....", it returns me jwt.exceptions.DecodeError: Invalid header padding However after I remove "bearer ", then it can decode it, no sweat. Is there a way that I can support this schema without hacking it? Thanks.

eulogio-gutierrez commented 3 years ago

Hi Kwiwon,

Unfortunately not. If you use the [jwt] annotation, it will expect the contents of your parameter to be the JWT payload as per https://datatracker.ietf.org/doc/html/rfc7519.

The best way to do this would be to allow you to create your own decoders (you could create a [bearer_jwt] decoder for instance). This will require some changes in our code base.

Thanks Eulogio