Skip to main content

fetch_oauth2_claims

Function fetch_oauth2_claims 

Source
pub async fn fetch_oauth2_claims(
    http_client: &Client,
    userinfo_endpoint: &str,
    access_token: &str,
    mapping: &ClaimMapping,
) -> Result<Value>
Expand description

Fetch the userinfo endpoint and return a normalized synthetic claims object.

The returned serde_json::Value always contains:

  • "sub" — stable string identifier (coerced from integer if needed)
  • "name" — display name or null
  • "email" — email address or null
  • "email_verified" — bool (false when the field is absent or null)

This object is structurally identical to what the OIDC path produces from a verified id_token, so all downstream code (identity mapping, provisioning) is unchanged.