Skip to main content

validate_token_with_header

Function validate_token_with_header 

Source
pub async fn validate_token_with_header<B>(
    req: &Request<B>,
    validator_url: &str,
    header_name: &str,
) -> Result<bool>
Expand description

Validate token with custom header name

Similar to validate_token but allows specifying a custom header name for the token (e.g., “X-Auth-Token” instead of “Authorization”).

§Arguments

  • req - The incoming HTTP request
  • validator_url - URL of the external token validation service
  • header_name - Name of the header containing the token

§Returns

  • Ok(true) - Token is valid
  • Ok(false) - Token is invalid
  • Err(...) - Error occurred during validation