aws-lambda-decorators icon indicating copy to clipboard operation
aws-lambda-decorators copied to clipboard

[JWT] Authorization: Bearer <token> support?

Open kwiwon opened this issue 4 years ago • 1 comments

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.

kwiwon avatar May 12 '21 22:05 kwiwon

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

eulogio-gutierrez avatar Jun 07 '21 10:06 eulogio-gutierrez