/// Decode a JWT to the user's ID
Decode a JWT to the user's ID
Decode a JWT to the user ' s ID
pub fn validate_token(token: &str) -> Result<ObjectId, GaneshaError> {
    let token = decode::<Claims>(
        token,
        &DecodingKey::from_secret(get_secret().as_ref()),
        &Validation::default(),
    )?;
    Ok(token
        .claims
        .sub
        .parse()
        .expect("token content to be object ID"))
}
pub fn validate_token ( token : & str ) -> Result < ObjectId , GaneshaError > { let token = decode :: < Claims > ( token , & DecodingKey :: from_secret ( get_secret ( ) . as_ref ( ) ) , & Validation :: default ( ) , ) ? ; Ok ( token . claims . sub . parse ( ) . expect ( " " ) ) }
Decode a JWT to the user's ID
Decode a JWT to the user ' s ID
token
&str