pub async fn validate_token(
tracking_label: &str,
token: &str,
uid: &str,
decoding_key_bytes: &[u8],
) -> Result<TokenData<TokenClaim>, String>Expand description
validate_token
validate a decoded jwt token
- create a token validator object
- decode the client’s jwt with the
decoding_key_bytesand validate the contents
Change the decoding key with the
enviroment variable:
TOKEN_ALGO_PUBLIC_KEY
§Returns
§validate_token on Success Returns
A valid user token will return:
Ok(TokenData)
§Arguments
tracking_label-&str- custom, unique identifiertoken-&str- custom, unique org identifieruid-&str- epoch time when the token expiresdecoding_key_bytes-&[u8]- jwt key contents in bytes
§Errors
§validate_token on Failure Returns
String error messages can be returned for many reasons
(connectivity, aws credentials, mfa timeouts, etc.)
Err(err_msg: String)
If it is not a valid user token it will return:
Err(err_msg: String)