Template Function jwt::decode(const jwt::string_view, const params::detail::algorithms_param<SequenceT>&, std::error_code&, Args&&…)
Defined in File jwt.ipp
Function Documentation
-
template<typename SequenceT, typename ...Args>
jwt_object jwt::decode(const jwt::string_view enc_str, const params::detail::algorithms_param<SequenceT> &algos, std::error_code &ec, Args&&... args) Decode the JWT signature to create the
jwt_object
. This version reports error back usingstd::error_code
.If any of the registered claims are found in wrong format then sets TypeConversion error in the error_code.
NOTE: Memory allocation exceptions are not caught.
Optional parameters that can be passed:
verify : A boolean flag to indicate whether the signature should be verified or not. Set to
true
by default.leeway : Number of seconds that can be added (in case of exp) or subtracted (in case of nbf) to be more lenient. Set to
0
by default.algorithms : Takes in a sequence of algorithms which the client expects the signature to be decoded with.
aud : The audience the client expects to be in the claim. NOTE: It is case-sensitive.
issuer: The issuer the client expects to be in the claim. NOTE: It is case-sensitive
sub: The subject the client expects to be in the claim.
validate_iat: Checks if IAT claim is present or not and the type is uint64_t or not. If claim is not present then set InvalidIAT error.
validate_jti: Checks if jti claim is present or not.