[][src]Struct onedrive_api::Auth

pub struct Auth { /* fields omitted */ }

OAuth2 authentication and authorization basics for Microsoft Graph.

See also

Microsoft Docs

Implementations

impl Auth[src]

pub fn new(
    client_id: String,
    permission: Permission,
    redirect_uri: String
) -> Self
[src]

Create an new instance for OAuth2 to Microsoft Graph with specified client identifier and permission.

pub fn new_with_client(
    client: Client,
    client_id: String,
    permission: Permission,
    redirect_uri: String
) -> Self
[src]

Same as Auth::new but with custom reqwest::Client.

pub fn client_id(&self) -> &str[src]

Get the client_id used to create this instance.

pub fn permission(&self) -> &Permission[src]

Get the permission used to create this instance.

pub fn redirect_uri(&self) -> &str[src]

Get the redirect_uri used to create this instance.

pub fn code_auth_url(&self) -> String[src]

Get the URL for web browser for code flow.

See also

Microsoft Docs

pub async fn login_with_code<'_, '_, '_>(
    &'_ self,
    code: &'_ str,
    client_secret: Option<&'_ str>
) -> Result<TokenResponse>
[src]

Login using a code.

See also

Microsoft Docs

pub async fn login_with_refresh_token<'_, '_, '_>(
    &'_ self,
    refresh_token: &'_ str,
    client_secret: Option<&'_ str>
) -> Result<TokenResponse>
[src]

Login using a refresh token.

This requires offline_access, and will ALWAYS return a new refresh_token if success.

Panic

Panic if the current Auth is created with no offline_access permission.

See also

Microsoft Docs

Trait Implementations

impl Debug for Auth[src]

Auto Trait Implementations

impl !RefUnwindSafe for Auth

impl Send for Auth

impl Sync for Auth

impl Unpin for Auth

impl !UnwindSafe for Auth

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.