Struct auth0_client::Auth0Client
source · pub struct Auth0Client { /* private fields */ }
Expand description
The client used to make requests towards the Auth0 API.
Implementations§
source§impl Auth0Client
impl Auth0Client
sourcepub fn new(
client_id: &str,
client_secret: &str,
domain: &str,
audience: &str
) -> Auth0Client
pub fn new( client_id: &str, client_secret: &str, domain: &str, audience: &str ) -> Auth0Client
Creates a new client from given configuration.
sourcepub fn grant_type(&mut self, grant_type: GrantType) -> &Auth0Client
pub fn grant_type(&mut self, grant_type: GrantType) -> &Auth0Client
Sets the grant type for the client.
sourcepub async fn request<B, R, E>(
&mut self,
method: Method,
path: &str,
body: Option<B>
) -> Auth0Result<Option<R>>
pub async fn request<B, R, E>( &mut self, method: Method, path: &str, body: Option<B> ) -> Auth0Result<Option<R>>
Make a request towards the Auth0 API. It uses the audience
field as the base URL.
If access token is expired, it will first try to get a new one.
§Parameters
method
: The HTTP method to use.path
: The path to use for the request.body
: The body to send with the request.
§Example
client.request::<String, UserResponse, UserError>(reqwest::Method::GET, "/api/v2/users", None).await?;
Trait Implementations§
source§impl Authenticatable for Auth0Client
impl Authenticatable for Auth0Client
source§fn authenticate<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Auth0Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Auth0Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Authenticates the client from its configuration. Read more
source§fn authenticate_user<'life0, 'async_trait>(
&'life0 mut self,
username: String,
password: String
) -> Pin<Box<dyn Future<Output = Auth0Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate_user<'life0, 'async_trait>(
&'life0 mut self,
username: String,
password: String
) -> Pin<Box<dyn Future<Output = Auth0Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Authenticates the a user from its password. Read more
source§fn authenticate_with_body<'life0, 'life1, 'async_trait>(
&'life0 mut self,
body: HashMap<&'life1 str, String>
) -> Pin<Box<dyn Future<Output = Auth0Result<AccessTokenResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn authenticate_with_body<'life0, 'life1, 'async_trait>(
&'life0 mut self,
body: HashMap<&'life1 str, String>
) -> Pin<Box<dyn Future<Output = Auth0Result<AccessTokenResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Calls an authentication request with body
source§fn access_token(&self) -> Option<String>
fn access_token(&self) -> Option<String>
Returns the access token if autenticated or
None
if it is not.source§impl OperateUsers for Auth0Client
impl OperateUsers for Auth0Client
source§fn get_user<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Auth0Result<UserResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Auth0Result<UserResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets a user through the Auth0 users API. Read more
source§fn get_user_by_email<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
email: &'life1 str,
connection: &'life2 str
) -> Pin<Box<dyn Future<Output = Auth0Result<Option<UserResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_user_by_email<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
email: &'life1 str,
connection: &'life2 str
) -> Pin<Box<dyn Future<Output = Auth0Result<Option<UserResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets a user through the Auth0 users API. Read more
source§fn create_user<'life0, 'life1, 'async_trait>(
&'life0 mut self,
payload: &'life1 CreateUserPayload
) -> Pin<Box<dyn Future<Output = Auth0Result<UserResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_user<'life0, 'life1, 'async_trait>(
&'life0 mut self,
payload: &'life1 CreateUserPayload
) -> Pin<Box<dyn Future<Output = Auth0Result<UserResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a user through the Auth0 users API. Read more
source§fn update_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
user_id: &'life1 str,
payload: &'life2 UpdateUserPayload
) -> Pin<Box<dyn Future<Output = Auth0Result<UserResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
user_id: &'life1 str,
payload: &'life2 UpdateUserPayload
) -> Pin<Box<dyn Future<Output = Auth0Result<UserResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Updates a user through the Auth0 users API. Read more
source§fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Auth0Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Auth0Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes a user through the Auth0 users API. Read more
source§fn check_password<'life0, 'life1, 'async_trait>(
&'life0 mut self,
payload: &'life1 CheckPasswordPayload
) -> Pin<Box<dyn Future<Output = Auth0Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_password<'life0, 'life1, 'async_trait>(
&'life0 mut self,
payload: &'life1 CheckPasswordPayload
) -> Pin<Box<dyn Future<Output = Auth0Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check a user’s password through the Auth0 users API. Read more
Auto Trait Implementations§
impl Freeze for Auth0Client
impl !RefUnwindSafe for Auth0Client
impl Send for Auth0Client
impl Sync for Auth0Client
impl Unpin for Auth0Client
impl !UnwindSafe for Auth0Client
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