pub struct Auth { /* private fields */ }
Expand description
Implementations§
Source§impl Auth
impl Auth
Sourcepub fn new(
client_id: impl Into<String>,
permission: Permission,
redirect_uri: impl Into<String>,
tenant: Tenant,
) -> Self
pub fn new( client_id: impl Into<String>, permission: Permission, redirect_uri: impl Into<String>, tenant: Tenant, ) -> Self
Create an new instance for OAuth2 to Microsoft Graph with specified client identifier and permission.
Sourcepub fn new_with_client(
client: Client,
client_id: impl Into<String>,
permission: Permission,
redirect_uri: impl Into<String>,
tenant: Tenant,
) -> Self
pub fn new_with_client( client: Client, client_id: impl Into<String>, permission: Permission, redirect_uri: impl Into<String>, tenant: Tenant, ) -> Self
Same as Auth::new
but with custom reqwest::Client
.
Sourcepub fn permission(&self) -> &Permission
pub fn permission(&self) -> &Permission
Get the permission
used to create this instance.
Sourcepub fn redirect_uri(&self) -> &str
pub fn redirect_uri(&self) -> &str
Get the redirect_uri
used to create this instance.
Sourcepub fn code_auth_url(&self) -> Url
pub fn code_auth_url(&self) -> Url
Sourcepub async fn login_with_code(
&self,
code: &str,
client_credential: &ClientCredential,
) -> Result<TokenResponse>
pub async fn login_with_code( &self, code: &str, client_credential: &ClientCredential, ) -> Result<TokenResponse>
Sourcepub async fn login_with_refresh_token(
&self,
refresh_token: &str,
client_credential: &ClientCredential,
) -> Result<TokenResponse>
pub async fn login_with_refresh_token( &self, refresh_token: &str, client_credential: &ClientCredential, ) -> Result<TokenResponse>
Login using a refresh token.
This requires offline_access
, and will ALWAYS return
a new refresh_token
if success.
§Panics
Panic if the current Auth
is created with no
offline_access
permission.
§See also
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Auth
impl !RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl !UnwindSafe for Auth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more