|
6 | 6 | |-------|--------|-------------|
|
7 | 7 | | [/auth/google/login](#get-authgooglelogin) | GET | Initiates the Google OAuth authentication |
|
8 | 8 | | [/auth/google/callback](#get-authgooglecallback) | GET | Handles the callback from Google after the user authenticates |
|
| 9 | +| [/auth/github/login](#get-authgithublogin) | GET | Initiates the GitHub OAuth authentication | |
| 10 | +| [/auth/github/callback](#get-authgithubcallback) | GET | Handles the callback from GitHub after the user authenticates | |
9 | 11 |
|
10 | 12 | ## GET /auth/google/login
|
11 | 13 |
|
@@ -64,6 +66,97 @@ Handles the callback from Google after the user authenticates, exchanges the aut
|
64 | 66 |
|
65 | 67 | ### Response
|
66 | 68 |
|
| 69 | +- **Success Response**: |
| 70 | + - **Code**: 302 |
| 71 | + - **Content**: Redirects to the specified redirectURL or https://my.realdevsquad.com/new-signup if user details are incomplete. |
| 72 | +
|
| 73 | + ``` |
| 74 | + Location: {redirectURL} |
| 75 | + ``` |
| 76 | + - **Cookie**: A secure JWT authentication token (rds-session) is set as a cookie to maintain the user's session. |
| 77 | + ``` |
| 78 | + Set-Cookie: rds-session=<jwt_token>; Domain={realdevsqual.com}; Expires={expirationTime}; HttpOnly; Secure; SameSite=Lax |
| 79 | + ``` |
| 80 | +
|
| 81 | +- **Error Response:** |
| 82 | + - **Code:** 401 |
| 83 | + - **Content:** |
| 84 | +
|
| 85 | + ```json |
| 86 | + { |
| 87 | + "statusCode": 401, |
| 88 | + "error": "Unauthorized", |
| 89 | + "message": "User cannot be authenticated" |
| 90 | + } |
| 91 | + ``` |
| 92 | + - **Code:** 500 |
| 93 | +
|
| 94 | + - **Content:** |
| 95 | +
|
| 96 | + ```json |
| 97 | + { |
| 98 | + "statusCode": 500, |
| 99 | + "error": "Internal Server Error", |
| 100 | + "message": "An internal server error occurred" |
| 101 | + } |
| 102 | + ``` |
| 103 | +## GET /auth/github/login |
| 104 | +
|
| 105 | +Initiates the GitHub OAuth authentication process by redirecting the user to GitHub's consent screen. |
| 106 | +
|
| 107 | +- **Params** |
| 108 | + None |
| 109 | +
|
| 110 | +- **Query** |
| 111 | + - Optional: `redirectURL=[string]` (The URL to redirect the user to after authentication is successful. It should be a valid URL.) |
| 112 | +
|
| 113 | +### Response |
| 114 | +
|
| 115 | +- **Success Response**: |
| 116 | + - **Code:** 302 |
| 117 | +
|
| 118 | + - **Content:** Redirects to GitHub's OAuth 2.0 consent screen for user authentication. |
| 119 | +
|
| 120 | + ```text |
| 121 | + Location: Location: https://github.com/login/oauth/authorize?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&response_type=code&scope=user:email&state={state} |
| 122 | + ``` |
| 123 | +
|
| 124 | +- **Error Response:** |
| 125 | + - **Code:** 401 |
| 126 | + - **Content:** |
| 127 | +
|
| 128 | + ```json |
| 129 | + { |
| 130 | + "statusCode": 401, |
| 131 | + "error": "Unauthorized", |
| 132 | + "message": "User cannot be authenticated" |
| 133 | + } |
| 134 | + ``` |
| 135 | + - **Code:** 500 |
| 136 | +
|
| 137 | + - **Content:** |
| 138 | +
|
| 139 | + ```json |
| 140 | + { |
| 141 | + "statusCode": 500, |
| 142 | + "error": "Internal Server Error", |
| 143 | + "message": "An internal server error occurred" |
| 144 | + } |
| 145 | + ``` |
| 146 | +
|
| 147 | +## GET /auth/github/callback |
| 148 | +
|
| 149 | +Handles the callback from GitHub after the user authenticates, exchanges the authorization code for an access token, and completes the user login process. |
| 150 | +
|
| 151 | +- **Params** |
| 152 | + None |
| 153 | +
|
| 154 | +- **Query** |
| 155 | + - Required: `code=[string]` (The authorization code returned by GitHub after the user grants consent.) |
| 156 | + - Required: `state=[string]` (The state parameter returned by GitHub, used to verify the request’s legitimacy and ensure security.) |
| 157 | +
|
| 158 | +### Response |
| 159 | +
|
67 | 160 | - **Success Response**:
|
68 | 161 | - **Code**: 302
|
69 | 162 | - **Content**: Redirects to the specified redirectURL or https://my.realdevsquad.com/new-signup if user details are incomplete.
|
|
0 commit comments