mikkyang / rust-jwt

JSON Web Token library for Rust
MIT License
178 stars 38 forks source link

How to add Claims of different value type? #95

Closed lcmgh closed 1 year ago

lcmgh commented 1 year ago

This does obviously not work

let mut claims:  BTreeMap<String, String>  = BTreeMap::new();
claims.insert("aud".to_string(), "example".to_string());
claims.insert("exp".to_string(), 1696500244);

Is the recommended approach here to simply use String for everything which would not work for me cause I also need to add a custom JSON object as value.

lcmgh commented 1 year ago

Nevermind, the README states: Claims can be any serde::Serialize type, usually derived with serde_derive.