pub trait Provider: Send + Sync + 'static {
    // Required methods
    fn auth_uri(&self) -> Cow<'_, str>;
    fn token_uri(&self) -> Cow<'_, str>;
}
Expand description

A Provider can retrieve authorization and token exchange URIs specific to an OAuth service provider.

In most cases, StaticProvider should be used instead of implementing Provider manually. Provider should be implemented if the URIs will change during runtime.

Required Methods§

source

fn auth_uri(&self) -> Cow<'_, str>

Returns the authorization URI associated with the service provider.

Example
use rocket_oauth2::{Provider, StaticProvider};

assert_eq!(StaticProvider::GitHub.auth_uri(), "https://github.com/login/oauth/authorize");
source

fn token_uri(&self) -> Cow<'_, str>

Returns the token exchange URI associated with the service provider.

Example
use rocket_oauth2::{Provider, StaticProvider};

assert_eq!(StaticProvider::GitHub.token_uri(), "https://github.com/login/oauth/access_token");

Implementors§