pub trait OAuthProvider: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn login<'a>(
&'a self,
interaction: &'a Interaction,
options: &'a LoginOptions,
) -> BoxFuture<'a, Result<OAuthCredential, AuthError>>;
fn refresh<'a>(
&'a self,
credential: &'a OAuthCredential,
cancel: &'a CancellationToken,
) -> BoxFuture<'a, Result<OAuthCredential, AuthError>>;
// Provided methods
fn login_label(&self) -> Option<&str> { ... }
fn is_subscription(&self) -> bool { ... }
fn to_auth<'a>(
&'a self,
credential: &'a OAuthCredential,
) -> BoxFuture<'a, Result<OAuthAuth, AuthError>> { ... }
}Expand description
An account sign-in: log in, refresh, and derive request credentials.
Required Methods§
Sourcefn login<'a>(
&'a self,
interaction: &'a Interaction,
options: &'a LoginOptions,
) -> BoxFuture<'a, Result<OAuthCredential, AuthError>>
fn login<'a>( &'a self, interaction: &'a Interaction, options: &'a LoginOptions, ) -> BoxFuture<'a, Result<OAuthCredential, AuthError>>
Runs the sign-in.
Sourcefn refresh<'a>(
&'a self,
credential: &'a OAuthCredential,
cancel: &'a CancellationToken,
) -> BoxFuture<'a, Result<OAuthCredential, AuthError>>
fn refresh<'a>( &'a self, credential: &'a OAuthCredential, cancel: &'a CancellationToken, ) -> BoxFuture<'a, Result<OAuthCredential, AuthError>>
Exchanges the refresh token for a new credential.
Provided Methods§
Sourcefn login_label(&self) -> Option<&str>
fn login_label(&self) -> Option<&str>
Label of the login menu entry, when the provider sets one.
Sourcefn is_subscription(&self) -> bool
fn is_subscription(&self) -> bool
Whether the account is a subscription, which the login menu labels.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".