-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from COS301-SE-2024/feat/backend/auth0-mongodb…
…-signup_login Feat/backend/auth0 mongodb signup login
- Loading branch information
Showing
19 changed files
with
1,181 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,26 +71,25 @@ The authentication endpoints are used to register, login, and verify users. Only | |
- **Success Response** | ||
|
||
- **Code:** 200 | ||
- **Content:** `{ "message": "User registered successfully" }` | ||
- **Content:** `{ "status": 200, "message": "Registration successful! Please check your email for the OTP to verify your account.", "data": {}, }` | ||
|
||
- **Error Response** | ||
**Error Response** | ||
|
||
- **Code:** 400 | ||
- **Content:** `{ "message": "Bad Request" }` | ||
- **Content:** `{"status": 400, "message": "Invalid email address": {"code": "INVALID_REQUEST_PAYLOAD","message": "Expected a valid format for email address": {}}}` | ||
|
||
|
||
- **Error Response** | ||
|
||
- **Code:** 500 | ||
- **Content:** `{ "message": "Internal server error" }` | ||
- **Content:** `{"status": 500, "message": "Internal Server Error","error": {"code": "INTERNAL_SERVER_ERROR","message": "Internal Server Error","details": {}}}` | ||
|
||
***Example json to send:*** | ||
|
||
```json copy | ||
{ | ||
"ID": "1", | ||
"Email": "[email protected]", | ||
"Password": "123456", | ||
"Token": "$123456$", | ||
"email": "[email protected]", | ||
"password": "123456", | ||
} | ||
``` | ||
|
||
|
@@ -106,13 +105,25 @@ The authentication endpoints are used to register, login, and verify users. Only | |
|
||
- **Success Response** | ||
|
||
- `This endpoint is yet to be defined` | ||
- **Code:** 200 | ||
- **Content:** `{ "status": 200, "message": "Successful login!", "data": {}, }` | ||
|
||
**Error Response** | ||
|
||
- **Code:** 400 | ||
- **Content:** `{"status": 400, "message": "Invalid email address": {"code": "INVALID_REQUEST_PAYLOAD","message": "Expected a valid format for email address": {}}}` | ||
|
||
- **Error Response** | ||
|
||
- **Code:** 500 | ||
- **Content:** `{"status": 500, "message": "Internal Server Error","error": {"code": "INTERNAL_SERVER_ERROR","message": "Internal Server Error","details": {}}}` | ||
|
||
***Example json to send:*** | ||
|
||
```json copy | ||
{ | ||
|
||
"email": "[email protected]", | ||
"password": "123456", | ||
} | ||
``` | ||
|
||
|
@@ -129,19 +140,24 @@ The authentication endpoints are used to register, login, and verify users. Only | |
- **Success Response** | ||
|
||
- **Code:** 200 | ||
- **Content:** `{ "message": "Email verified successfully!" }` | ||
- **Content:** `{ "status": 200, "message": "OTP verified successfully!", "data": {}, }` | ||
|
||
- **Error Response** | ||
|
||
- **Code:** 400 | ||
- **Content:** `{ "message": "Invalid request payload" }` | ||
- **Content:** `{"status": 400, "message": "Invalid OTP": {"code": "INVALID_AUTH","message": "Email not registered, otp expired or invalid": {}}}` | ||
|
||
- **Error Response** | ||
|
||
- **Code:** 500 | ||
- **Content:** `{"status": 500, "message": "Internal Server Error","error": {"code": "INTERNAL_SERVER_ERROR","message": "Internal Server Error","details": {}}}` | ||
|
||
***Example json to send:*** | ||
|
||
```json copy | ||
{ | ||
"Email": "[email protected]", | ||
"OTP": "123456" | ||
"email": "[email protected]", | ||
"oTP": "123456" | ||
} | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
*.log | ||
*.pem | ||
|
||
/web | ||
/web | ||
|
||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package constants | ||
|
||
const InvalidRequestPayloadCode = "INVALID_REQUEST_PAYLOAD" | ||
const BadRequestCode = "BAD_REQUEST" | ||
const InvalidAuthCode = "INVALID_AUTH" | ||
const IncompleteAuthCode = "INCOMPLETE_AUTH" | ||
const InternalServerErrorCode = "INTERNAL_SERVER_ERROR" |
Oops, something went wrong.