Struct onedrive_api::client::AuthClient
source · pub struct AuthClient { /* private fields */ }Expand description
The client for requests relative to authentication.
See also
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth?view=odsp-graph-online
Implementations§
source§impl AuthClient
impl AuthClient
pub fn new(client_id: String, scope: Scope, redirect_uri: String) -> Self
sourcepub fn get_token_auth_url(&self) -> String
pub fn get_token_auth_url(&self) -> String
Get the URL for web browser for token flow authentication.
See also
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth?view=odsp-graph-online#token-flow
sourcepub fn get_code_auth_url(&self) -> String
pub fn get_code_auth_url(&self) -> String
Get the URL for web browser for code flow authentication.
See also
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth?view=odsp-graph-online#step-1-get-an-authorization-code
sourcepub fn login_with_code(
&self,
code: &str,
client_secret: Option<&str>
) -> Result<Client>
pub fn login_with_code(
&self,
code: &str,
client_secret: Option<&str>
) -> Result<Client>
Login using a code in code flow authentication.
See also
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth?view=odsp-graph-online#step-2-redeem-the-code-for-access-tokens
sourcepub fn login_with_refresh_token(
&self,
refresh_token: &str,
client_secret: Option<&str>
) -> Result<Client>
pub fn login_with_refresh_token(
&self,
refresh_token: &str,
client_secret: Option<&str>
) -> Result<Client>
Login using a refresh token. This requires offline access.
Panic
Panic if the scope given in Client::new has no offline_access scope.
See also
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth?view=odsp-graph-online#step-3-get-a-new-access-token-or-refresh-token