[][src]Trait rocket_oauth2::Provider

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

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

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");

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");
Loading content...

Implementors

impl Provider for StaticProvider[src]

Loading content...