gh-oauth

Crates.iogh-oauth
lib.rsgh-oauth
version0.1.3
created_at2026-01-07 00:22:51.855866+00
updated_at2026-01-07 00:43:10.515115+00
descriptionA small library to run OAuth against GitHub
homepagehttps://github.com/rivethorn/ghoauth-rs
repositoryhttps://github.com/rivethorn/ghoauth-rs
max_upload_size
id2027206
size57,671
Hassan Qasemi (rivethorn)

documentation

README

GitHub OAuth for Rust

Crates.io Version

A very simple library for Rust client applications that need to perform OAuth authorization against GitHub.

Based on https://github.com/cli/oauth

Usage

use gh_oauth::*;

fn main() {
    let oauth = GitHubOAuth::new("OAUTH_CLIENT_ID", "repo read:user gist");

    let prompt = oauth.request_device_code().unwrap();

    println!("Visit: {}", prompt.verification_uri);
    println!("Code: {}", prompt.user_code);

    let token = oauth.poll_token(&prompt).unwrap();

    println!("Access token: {}", token.access_token);
}
Commit count: 14

cargo fmt