Skip to main content

rustauth_core/api/routes/
mod.rs

1//! Framework-neutral auth route builders.
2
3use http::Method;
4
5use crate::api::AsyncAuthEndpoint;
6
7mod account;
8mod change_email;
9mod delete_user;
10pub(in crate::api) mod email_verification;
11mod error;
12mod password;
13mod session;
14mod shared;
15mod sign_in;
16mod sign_out;
17mod sign_up;
18#[cfg(feature = "oauth")]
19mod social;
20mod update_user;
21
22/// Build Better Auth-inspired core endpoints backed by an RustAuth database adapter.
23///
24/// The returned endpoints are framework-neutral and can be passed to
25/// `AuthRouter::with_async_endpoints` or the public `rustauth_with_endpoints`
26/// initializer. Concrete web frameworks only need to adapt HTTP requests and
27/// responses at their edge.
28pub fn core_auth_async_endpoints() -> Vec<AsyncAuthEndpoint> {
29    vec![
30        sign_up::sign_up_email_endpoint(),
31        sign_in::sign_in_email_endpoint(),
32        #[cfg(feature = "oauth")]
33        social::sign_in_social_endpoint(),
34        #[cfg(feature = "oauth")]
35        social::callback_oauth_endpoint(Method::GET),
36        #[cfg(feature = "oauth")]
37        social::callback_oauth_endpoint(Method::POST),
38        #[cfg(feature = "oauth")]
39        social::link_social_endpoint(),
40        error::error_endpoint(),
41        session::get_session_endpoint(Method::GET),
42        session::get_session_endpoint(Method::POST),
43        session::list_sessions_endpoint(),
44        session::update_session_endpoint(),
45        session::revoke_session_endpoint(),
46        session::revoke_sessions_endpoint(),
47        session::revoke_other_sessions_endpoint(),
48        account::list_user_accounts_endpoint(),
49        account::unlink_account_endpoint(),
50        #[cfg(feature = "oauth")]
51        account::get_access_token_endpoint(),
52        #[cfg(feature = "oauth")]
53        account::refresh_token_endpoint(),
54        #[cfg(feature = "oauth")]
55        account::account_info_endpoint(),
56        update_user::update_user_endpoint(),
57        change_email::change_email_endpoint(),
58        email_verification::send_verification_email_endpoint(),
59        email_verification::verify_email_endpoint(),
60        delete_user::delete_user_endpoint(),
61        delete_user::delete_user_callback_endpoint(),
62        password::change_password_endpoint(),
63        password::set_password_endpoint(),
64        password::verify_password_endpoint(),
65        password::request_password_reset_endpoint(),
66        password::reset_password_callback_endpoint(),
67        password::reset_password_endpoint(),
68        sign_out::sign_out_endpoint(),
69    ]
70}