Function fetch_jwks

Source
pub async fn fetch_jwks(oidc_url: &str) -> Result<GithubJWKS, GitHubOIDCError>
Expand description

Fetches the JSON Web Key Set (JWKS) from the specified OIDC URL.

§Arguments

  • oidc_url - The base URL of the OpenID Connect provider (GitHub by default)

§Returns

  • Result<GithubJWKS, GitHubOIDCError> - A Result containing the fetched JWKS if successful, or an error if the fetch or parsing fails

§Example

use github_oidc::{fetch_jwks, DEFAULT_GITHUB_OIDC_URL};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let jwks = fetch_jwks(DEFAULT_GITHUB_OIDC_URL).await?;
    println!("JWKS: {:?}", jwks);
    Ok(())
}