Skip to content

Commit 39583b0

Browse files
author
Matheus Galvao
committed
Updated docs about authentication
1 parent 24bbfd0 commit 39583b0

1 file changed

Lines changed: 40 additions & 8 deletions

File tree

app/routes/docs.py

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,41 +137,73 @@ def _get_auth_docs():
137137
AuthMethod.JWT: {
138138
"method": "jwt",
139139
"description": "JWT (JSON Web Token) authentication required for protected endpoints.",
140-
"how_to_authenticate": "1. Get a token via /auth/login or /auth/signup\n2. Include the token in the Authorization header.",
140+
"how_to_authenticate": (
141+
"1. Create account via /auth/signup\n"
142+
"2. Get tokens via /auth/login\n"
143+
"3. Include the access token in the Authorization header\n"
144+
"4. Use /auth/refresh with refresh token to get new tokens\n"
145+
"5. Use /auth/logout with both tokens to end session"
146+
),
141147
"endpoints": {
142148
"/auth/signup": {
143149
"method": "POST",
144150
"body": {"username": "string", "password": "string"},
145-
"response": {"token": "string"}
151+
"response": {"message": "Signup successful. Please log in to continue."}
146152
},
147153
"/auth/login": {
148154
"method": "POST",
149155
"body": {"username": "string", "password": "string"},
150-
"response": {"token": "string"}
156+
"response": {
157+
"message": "Login successful",
158+
"access_token": "string",
159+
"refresh_token": "string"
160+
}
161+
},
162+
"/auth/refresh": {
163+
"method": "POST",
164+
"body": {"refresh_token": "string"},
165+
"response": {
166+
"access_token": "string",
167+
"refresh_token": "string"
168+
}
169+
},
170+
"/auth/logout": {
171+
"method": "POST",
172+
"headers": {"Authorization": "Bearer <access_token>"},
173+
"body": {"refresh_token": "string"},
174+
"response": {"message": "string"}
151175
}
152176
},
153177
"example": {
154178
"headers": {
155-
"Authorization": "Bearer your-jwt-token-here"
179+
"Authorization": "Bearer your-jwt-access-token-here"
156180
}
157181
},
158182
"protected_endpoints": ["/todos/*", "/notes/*"]
159183
},
160184
AuthMethod.SESSION: {
161185
"method": "session",
162186
"description": "Session-based authentication required for protected endpoints.",
163-
"how_to_authenticate": "1. Login via /auth/login or signup via /auth/signup\n2. Session cookie will be automatically managed by your browser.",
187+
"how_to_authenticate": (
188+
"1. Create account via /auth/signup\n"
189+
"2. Login via /auth/login to create a session\n"
190+
"3. Session cookie will be automatically managed by your browser\n"
191+
"4. Use /auth/logout to end your session"
192+
),
164193
"endpoints": {
165194
"/auth/signup": {
166195
"method": "POST",
167-
"body": {"username": "string", "password": "string"}
196+
"body": {"username": "string", "password": "string"},
197+
"response": {"message": "Signup successful. Please log in to continue."}
168198
},
169199
"/auth/login": {
170200
"method": "POST",
171-
"body": {"username": "string", "password": "string"}
201+
"body": {"username": "string", "password": "string"},
202+
"response": {"message": "Login successful"}
172203
},
173204
"/auth/logout": {
174-
"method": "POST"
205+
"method": "POST",
206+
"response": {"message": "Logout successful"}
175207
}
176208
},
177209
"protected_endpoints": ["/todos/*", "/notes/*"]

0 commit comments

Comments
 (0)