-
Notifications
You must be signed in to change notification settings - Fork 1
Authentication API
M♢NTΛSIM edited this page Aug 17, 2024
·
1 revision
-
POST
/login
- Summary: Authenticates a user and returns a token.
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "type": "object", "properties": { "email": { "type": "string", "description": "Email address of the user." }, "password": { "type": "string", "description": "Password of the user." } } }
-
Content-Type:
-
Responses:
- 200 OK: Authentication successful.
- 401 Unauthorized: Authentication failed.
-
All Other Methods on
/login
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
GET
/logout
- Summary: Logs out a user and invalidates the session token.
-
Responses:
- 200 OK: Logout successful.
- 401 Unauthorized: User not logged in.
-
All Other Methods on
/logout
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
PUT
/request-new-password
- Summary: Initiates a password reset process for a user by sending them an email with a reset link.
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "type": "object", "properties": { "email": { "type": "string", "description": "Email address associated with the user account." } } }
-
Content-Type:
-
Responses:
- 200 OK: Reset email sent successfully.
- 404 Not Found: No user found with this email.
-
All Other Methods on
/request-new-password
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
GET
/resend-verification/{id}
- Summary: Resends the verification email to the user based on the user ID provided.
-
Parameters:
-
Path Parameter:
id
-
Type:
string
- Description: Unique identifier of the user.
-
Type:
-
Path Parameter:
-
Responses:
- 200 OK: Verification email resent successfully.
- 404 Not Found: User not found.
-
All Other Methods on
/resend-verification/{id}
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
PUT
/reset-password/{token}
- Summary: Allows a user to reset their password using a valid token received via email.
-
Parameters:
-
Path Parameter:
token
-
Type:
string
- Description: Token received for resetting the password.
-
Type:
-
Path Parameter:
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "type": "object", "properties": { "newPassword": { "type": "string", "description": "New password for the user." }, "confirmNewPassword": { "type": "string", "description": "Confirmation of the new password." } } }
-
Content-Type:
-
Responses:
- 200 OK: Password reset successfully.
- 403 Forbidden: Invalid or expired token.
-
All Other Methods on
/reset-password/{token}
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
POST
/signup
- Summary: Registers a new user and sends a verification email.
-
Request Body:
-
Content-Type:
application/json
-
Schema:
{ "type": "object", "properties": { "email": { "type": "string", "description": "Email address for the new user." }, "password": { "type": "string", "description": "Password for the new user." }, "confirmPassword": { "type": "string", "description": "Confirmation of the password." } } }
-
Content-Type:
-
Responses:
- 201 Created: User registered successfully.
- 409 Conflict: Email already in use.
- 400 Bad Request: Invalid data provided.
-
All Other Methods on
/signup
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
-
GET
/verify/{token}
- Summary: Verifies a user's email using a token.
-
Parameters:
-
Path Parameter:
token
-
Type:
string
- Description: Verification token sent to the user's email.
-
Type:
-
Path Parameter:
-
Responses:
- 200 OK: Email verified successfully.
- 403 Forbidden: Invalid or expired token.
-
All Other Methods on
/verify/{token}
- Summary: Handles unsupported methods.
-
Responses:
- 405 Method Not Allowed: Method not supported.
Feel free to adjust any details or add additional information as needed!