Skip to main content

SimpleOAuthProvider

Trait SimpleOAuthProvider 

Source
pub trait SimpleOAuthProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn authorize_url(&self) -> &str;
    fn token_url(&self) -> &str;
    fn user_info_url(&self) -> &str;
    fn default_scopes(&self) -> &'static [&'static str];
    fn extract_user_info(&self, val: Value) -> Result<UserInfo, Error>;

    // Provided method
    fn additional_headers(&self) -> Vec<(String, String)> { ... }
}
Expand description

Trait for all OAuth providers

Required Methods§

Source

fn authorize_url(&self) -> &str

The authorization endpoint of the provider

Source

fn token_url(&self) -> &str

The token endpoint of the provider

Source

fn user_info_url(&self) -> &str

The URL to fetch the user info from the provider

Source

fn default_scopes(&self) -> &'static [&'static str]

Minimum scopes needed to get basic profile info (id, name, username). Email is not included by default - the user can specify that by passing in custom scopes when calling client.authorize_url()

Source

fn extract_user_info(&self, val: Value) -> Result<UserInfo, Error>

Extract the user data from the provider’s user response

Provided Methods§

Source

fn additional_headers(&self) -> Vec<(String, String)>

Additional headers to send when making requests to the provider

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> SimpleOAuthProvider for Arc<T>

Source§

fn authorize_url(&self) -> &str

Source§

fn token_url(&self) -> &str

Source§

fn user_info_url(&self) -> &str

Source§

fn default_scopes(&self) -> &'static [&'static str]

Source§

fn extract_user_info(&self, val: Value) -> Result<UserInfo, Error>

Source§

fn additional_headers(&self) -> Vec<(String, String)>

Source§

impl<T> SimpleOAuthProvider for Box<T>

Source§

fn authorize_url(&self) -> &str

Source§

fn token_url(&self) -> &str

Source§

fn user_info_url(&self) -> &str

Source§

fn default_scopes(&self) -> &'static [&'static str]

Source§

fn extract_user_info(&self, val: Value) -> Result<UserInfo, Error>

Source§

fn additional_headers(&self) -> Vec<(String, String)>

Implementors§