pub trait OAuthProvider: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
scopes: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<DeviceCode>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn poll<'life0, 'life1, 'async_trait>(
&'life0 self,
device_code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PollOutcome>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn refresh<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A Rust implementation of one OAuth provider’s device-code flow.
Required Methods§
Sourcefn start<'life0, 'life1, 'async_trait>(
&'life0 self,
scopes: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<DeviceCode>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
scopes: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<DeviceCode>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Request a device code. Returns the data the user needs (user_code,
verification_url) plus the secret device_code + polling interval.
Sourcefn poll<'life0, 'life1, 'async_trait>(
&'life0 self,
device_code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PollOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn poll<'life0, 'life1, 'async_trait>(
&'life0 self,
device_code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PollOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Poll the token endpoint once. On success, store the token and return
Success; otherwise return the pending/expired/denied state.
Sourcefn refresh<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn refresh<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Refresh an expiring token (no-op for GitHub). Returns the refreshed
access_token.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".