validate_token

Function validate_token 

Source
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

  1. create a token validator object
  2. decode the client’s jwt with the decoding_key_bytes and 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 identifier
  • token - &str - custom, unique org identifier
  • uid - &str - epoch time when the token expires
  • decoding_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)