| Crates.io | gh-oauth |
| lib.rs | gh-oauth |
| version | 0.1.3 |
| created_at | 2026-01-07 00:22:51.855866+00 |
| updated_at | 2026-01-07 00:43:10.515115+00 |
| description | A small library to run OAuth against GitHub |
| homepage | https://github.com/rivethorn/ghoauth-rs |
| repository | https://github.com/rivethorn/ghoauth-rs |
| max_upload_size | |
| id | 2027206 |
| size | 57,671 |
A very simple library for Rust client applications that need to perform OAuth authorization against GitHub.
Based on https://github.com/cli/oauth
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);
}