Skip to main content

verify_id_token

Function verify_id_token 

Source
pub async fn verify_id_token(
    token: &str,
    jwks_uri: &str,
    expected_issuer: &str,
    expected_audience: &str,
    http: &Client,
) -> Result<VerifiedIdToken>
Expand description

Verify an external id_token against the provider’s JWKS.

Fetches the JWKS from the given URI, selects the appropriate key (by kid if present in the JWT header), and verifies the signature. Returns the decoded claims on success.

§Arguments

  • token — The raw JWT string (id_token from the external provider).
  • jwks_uri — The provider’s JWKS endpoint URL.
  • expected_issuer — The expected iss claim value (provider’s issuer URL).
  • expected_audience — The expected aud claim value (client_id).
  • http — HTTP client for fetching the JWKS.