[][src]Crate github_app_auth

This crate provides a library for authenticating with the GitHub API as a GitHub app. See Authenticating with GitHub Apps for details about the authentication flow.

Example:

use github_app_auth::{GithubAuthParams, InstallationToken};

// The token is mutable because the installation token must be
// periodically refreshed. See the `GithubAuthParams` documentation
// for details on how to get the private key and the two IDs.
let mut token = InstallationToken::new(GithubAuthParams {
    user_agent: "my-cool-user-agent".into(),
    private_key: b"my private key".to_vec(),
    app_id: 1234,
    installation_id: 5678,
}).expect("failed to get installation token");

// Getting the authentication header will automatically refresh
// the token if necessary, but of course this operation can fail.
let header = token.header().expect("failed to get authentication header");

token.client.post("https://some-github-api-url").headers(header).send();

Structs

GithubAuthParams

Input parameters for authenticating as a GitHub app. This is used to get an installation token.

InstallationToken

An installation token is the primary method for authenticating with the GitHub API as an application.

Enums

AuthError

Authentication error enum.