Skip to main content

Module auth

Module auth 

Source
Expand description

Authentication-related route handlers Handles user signup, login, account deletion, data retrieval, token refresh, and logout.

Structsยง

RefreshTokenRequest
SignupResponse

Functionsยง

delete_account
Handles user account deletion requests
extract_user_id ๐Ÿ”’
Extracts the user ID as a string from the User struct
get_user_data
Handles user data retrieval requests
login
Handles user login requests
logout
Handles user logout requests This endpoint allows clients to log out by revoking the provided refresh token. It removes the refresh token from the database, effectively invalidating it and preventing any further use for obtaining new access tokens.
refresh_token
Handles token refresh requests This endpoint allows clients to obtain a new access token using a valid refresh token. It verifies the refresh token, checks its validity in the database, and generates a new access token if everything is valid. The refresh token is not rotated in this implementation, but it can be easily modified to do so if desired.
signup
Handles user signup requests
update_user_profile
Handles user profile update requests This endpoint allows clients to update their user profile information, such as username and email. It verifies the provided data, updates the user profile in the database, and logs the operation.
verify_user_credentials ๐Ÿ”’
Verifies user credentials (username/email and password) against the database