pub struct Auth0Client { /* private fields */ }Implementations§
Source§impl Auth0Client
impl Auth0Client
pub fn new(config: &Auth0Config, token: String) -> Self
pub async fn get_user_by_email( &self, email: &str, ) -> Result<Vec<Auth0User>, AppError>
Sourcepub async fn get_or_create_user(
&self,
name: &str,
email: &str,
role: &Role,
) -> Result<Auth0User, AppError>
pub async fn get_or_create_user( &self, name: &str, email: &str, role: &Role, ) -> Result<Auth0User, AppError>
Gets or creates a user in Auth0, then assigns the given role.
- If the user already exists (looked up by email): updates their profile (name) and assigns the role.
- If the user does not exist: creates them with a random secure password and assigns the role.
role accepts values like "admin", "super_admin", or "worker" (mapped to "ADMIN",
"SUPER_ADMIN", "WORKER" in Auth0).
pub async fn update_user( &self, user_id: &str, req: UpdateUserRequest, ) -> Result<Auth0User, AppError>
Auto Trait Implementations§
impl Freeze for Auth0Client
impl !RefUnwindSafe for Auth0Client
impl Send for Auth0Client
impl Sync for Auth0Client
impl Unpin for Auth0Client
impl UnsafeUnpin 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