Jegan's SSO Auth System Code Explanation
https://docs.google.com/document/d/1tVIsBVRwF9cESAvhBLbqwJftuJtXcx8t-fO4KmB1QaQ/edit?usp=sharing
API Routes
- /api/signup: Handles user signup. Validates email and password, checks if the email is allowed, hashes the password, stores user data in the database, and sends a welcome email.
- /api/enroll: Handles TOTP enrollment. Generates a TOTP secret, stores it, and returns a QR code for 2FA setup.
- /api/login: Handles user login. Validates credentials, checks account lock status, generates tokens, and sets them as cookies.
- /api/validate: Validates the access token and returns user information if valid.
- /api/token/refresh: Refreshes the access token using a valid refresh token.
- /api/update_role: Updates the role of a user.
- /api/logout: Logs out the user by revoking tokens and clearing cookies.
- /api/request_reset: Initiates a password reset by generating a reset token and sending it via email.
- /api/reset_password/
: Resets the user's password using a valid reset token.
Comments
Post a Comment