Add Google Web Provider
This commit is contained in:
parent
b65caa33b4
commit
ac749b941c
|
@ -14,6 +14,7 @@
|
||||||
//! Support for the following OAuth 2.0 providers is included:
|
//! Support for the following OAuth 2.0 providers is included:
|
||||||
//!
|
//!
|
||||||
//! - Google
|
//! - Google
|
||||||
|
//! - Web
|
||||||
//! - Installed
|
//! - Installed
|
||||||
//! - GitHub
|
//! - GitHub
|
||||||
//! - Imgur
|
//! - Imgur
|
||||||
|
|
|
@ -40,9 +40,22 @@ pub trait Provider {
|
||||||
/// See [Using OAuth 2.0 to Access Google
|
/// See [Using OAuth 2.0 to Access Google
|
||||||
/// APIs](https://developers.google.com/identity/protocols/OAuth2).
|
/// APIs](https://developers.google.com/identity/protocols/OAuth2).
|
||||||
pub mod google {
|
pub mod google {
|
||||||
use token::{Bearer, Refresh};
|
use token::{Bearer, Expiring, Refresh};
|
||||||
use super::Provider;
|
use super::Provider;
|
||||||
|
|
||||||
|
/// Google OAuth 2.0 provider for web applications.
|
||||||
|
///
|
||||||
|
/// See [Using OAuth 2.0 for Web Server
|
||||||
|
/// Applications](https://developers.google.com/identity/protocols/OAuth2WebServer).
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct Web;
|
||||||
|
impl Provider for Web {
|
||||||
|
type Lifetime = Expiring;
|
||||||
|
type Token = Bearer<Expiring>;
|
||||||
|
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" }
|
||||||
|
}
|
||||||
|
|
||||||
/// Google OAuth 2.0 provider for installed applications.
|
/// Google OAuth 2.0 provider for installed applications.
|
||||||
///
|
///
|
||||||
/// See [Using OAuth 2.0 for Installed
|
/// See [Using OAuth 2.0 for Installed
|
||||||
|
|
Loading…
Reference in New Issue