arun11299 / cpp-jwt

JSON Web Token library for C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to remove type fromt he jwt_header

feliwir opened this issue · comments

I've also run into this issue.

According to the JWT RFC, the "typ" header field is optional (https://tools.ietf.org/html/rfc7519#section-5.1 ), but cpp-jwt returns an error when the "typ" field is not present:

ec = DecodeErrc::TypHeaderMiss;

I think it would be better to continue processing without an error in that case. When the "typ" field does exist, we can still validate that its value is "JWT", but when it does not exist there should be no error.

Please look at the encode and decode tests "TestRemoveTypHeader" and "TypHeaderMiss" respectively.
I have added an API to remove the header.