jsmn_token_decode_s

Synopsis

typedef struct jsmn_token_decode_s;

A “decoder” context used to decode a JSON web token string. Initialize a jsmn_token_decode_s context with jsmn_token_decode.

Examples

See Also

const char *jwt = \
   "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."\
   "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ."\
   "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";

int err;
jsmn_token_decode_s token;

// Decode and validate token
err = jsmn_token_decode(&token, "your-256-bit-secret", JSMN_ALG_HS256, jwt, strlen(jwt));
  1. jsmn_token_decode