[][src]Function jsonwebtoken::decode_header

pub fn decode_header(token: &str) -> Result<Header>

Decode a token and return the Header. This is not doing any kind of validation: it is meant to be used when you don't know which alg the token is using and want to find out.

If the token has an invalid format, it will return an error.

This example is not tested
use jsonwebtoken::decode_header;

let token = "a.jwt.token".to_string();
let header = decode_header(&token);