Authentication Flows & Endpoints
The auth_router provides all necessary API endpoints and HTML pages for a complete security system.
Just use the pages included in the router and if you want custom pages update the env var for templates dir ALL THE PAGES NEED TO BE INCLUDED IN THE NEW FOLDER AS I HAVE NOT IMPLEMENTED FALLBACK YET. Just copy paste dir if you want to update theme. (Maybe ima add theme configuration so that ppl wont have to copy pasta all files, no guarantee just thinking.)
Standard Authentication (`/auth`)
These endpoints handle user credentials and password security.
| Endpoint | Method | Function |
|---|---|---|
| /auth/signup | POST | User registration. |
| /auth/login | POST | User login. |
| /auth/logout | POST | Terminates the current session. |
| /auth/forgot-password | POST | Initiates password reset flow. |
| /auth/reset-password | POST | Completes password reset with a valid token. |
Redirect on Login
To enhance user experience, you can redirect users to a specific page after login by appending a return_url query parameter to the login page URL. The middleware will store this URL in a temporary cookie.
# Example: This will redirect the user to /settings after they log in.
http://localhost:8000/auth/login?return_url=/ui/settings