[−][src]Crate auth0_management
Unofficial Auth0 Management API.
Connection Handling
Authentication with Auth0 is handled for you provided you provide the values defined in the example below. For additional information reference the official Auth0 guide for obtaining auth tokens here.
use auth0_management::Auth0; async fn init() { let auth0 = Auth0::builder() .domain(env!("AUTH0_DOMAIN")) .audience(env!("AUTH0_AUDIENCE")) .client_id(env!("AUTH0_CLIENT_ID")) .client_secret(env!("AUTH0_CLIENT_SECRET")) .build() .unwrap(); }
User Management
use serde::{Serialize, Deserialize}; use auth0_management::{Auth0, Pageable, Sortable, Ordering, Auth0Request, User}; #[derive(Serialize, Deserialize)] struct Metadata; async fn test_users(auth0: &Auth0) { // Create a user. auth0 .users .create() .email("test@example.test") .connection("CONNECTION_ID") .send::<(), ()>() .await .expect("Failed to create a user."); // Find first user user sort by email address. let users: Vec<User<Metadata, Metadata>> = auth0 .users .find() .page(0) .per_page(1) .sort("email", Ordering::Ascending) .send() .await .expect("Failed to fetch users."); // Update found user. auth0 .users .update( &users .first() .expect("No users found") .user_id ) .email("test@test.test") .send::<(), ()>() .await .expect("Failed to update user."); }
Re-exports
pub use builder::*; |
pub use client::*; |
pub use error::*; |
pub use page::*; |
pub use sort::*; |
pub use users::*; |
Modules
api | |
builder | Builder for Auth0. |
client | Auth0 request client. |
connection | |
error | Error type for auth0 requests. |
page | Paging helper. |
sort | Sorting helper. |
strategy | |
users | User request builders. |
Structs
Auth0 | Auth0 management client. |
Traits
Auth0Request | Request |
Auth0RequestBuilder | Request builder |
Auth0RequestSimple | Simple request |