diff --git a/src/provider.rs b/src/provider.rs index b115e65..2e6a129 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -1,6 +1,6 @@ //! Providers. -use token::{Token, Lifetime, Bearer, Expiring}; +use token::{Token, Lifetime, Bearer, Static, Expiring}; /// OAuth 2.0 providers. pub trait Provider { @@ -32,3 +32,14 @@ impl Provider for Google { fn auth_uri() -> &'static str { "https://accounts.google.com/o/oauth2/v2/auth" } fn token_uri() -> &'static str { "https://www.googleapis.com/oauth2/v4/token" } } + +/// GitHub OAuth 2.0 provider. +/// +/// See [OAuth, GitHub Developer Guide](https://developer.github.com/v3/oauth/). +pub struct GitHub; +impl Provider for GitHub { + type Lifetime = Static; + type Token = Bearer; + fn auth_uri() -> &'static str { "https://github.com/login/oauth/authorize" } + fn token_uri() -> &'static str { "https://github.com/login/oauth/access_token" } +}