You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restructures the documentation to improve clarity and user experience:
- Renames 'guide' to 'user-guide' to better reflect its purpose.
- Adds a 'developer-guide' section for contributors and advanced users.
- Moves and renames files to fit the new structure.
- Updates links and navigation to reflect these changes.
Copy file name to clipboardExpand all lines: docs/api/index.md
+25-30Lines changed: 25 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# API Reference
1
+
# HTTP API Endpoints
2
2
3
-
The Nuxt Users module provides several API endpoints for authentication, user management, and password reset functionality.
3
+
The Nuxt Users module provides REST API endpoints for authentication, user management, and password reset functionality. These endpoints can be used by external applications or frontend clients to interact with the authentication system.
4
4
5
5
## Authentication Endpoints
6
6
@@ -53,13 +53,12 @@ Logout the current user by removing their authentication token.
53
53
```
54
54
55
55
**Notes:**
56
-
- Removes the authentication token from the database
57
-
- Clears the `auth_token` cookie
58
56
- No authentication required (works with any valid token)
57
+
- Invalidates the current session
59
58
60
59
## User Management Endpoints
61
60
62
-
Authentication and authorization are handled by middleware.
61
+
These endpoints require authentication. Include your authentication token in requests.
63
62
64
63
### Create User
65
64
@@ -102,7 +101,7 @@ Create a new user.
102
101
103
102
Get a user by ID. Users can only access their own profile unless they have admin permissions.
104
103
105
-
**Request:** No request body required (uses authentication token from cookie)
104
+
**Request:** No request body required
106
105
107
106
**Response:**
108
107
```json
@@ -199,7 +198,7 @@ Delete a user.
199
198
200
199
Get the current user's profile information.
201
200
202
-
**Request:** No request body required (uses authentication token from cookie)
201
+
**Request:** No request body required
203
202
204
203
**Response:**
205
204
```json
@@ -297,8 +296,7 @@ Send a password reset link to the user's email.
- Always returns success message for security reasons
302
300
- Token expires after 1 hour
303
301
304
302
### Reset Password
@@ -339,36 +337,33 @@ All endpoints return consistent error responses:
339
337
}
340
338
```
341
339
342
-
## Authentication Headers
340
+
## Authentication
343
341
344
-
For protected endpoints, include the authentication cookie:
342
+
For protected endpoints, authentication is handled automatically through cookies when using the module's built-in authentication flow. External API consumers should ensure they include the authentication cookie in their requests.
345
343
346
-
```
347
-
Cookie: auth_token=your-auth-token
348
-
```
344
+
## Authorization
349
345
350
-
The module automatically handles cookie management for login/logout.
351
-
352
-
## Permission System
353
-
354
-
The user management endpoints use a role-based permission system. Permissions can be configured to be method-specific (e.g., allowing GET but denying DELETE on the same path). See the [Authorization Guide](/guide/authorization) for more details.
346
+
The API uses role-based access control:
355
347
356
348
-**Admin users** (`role: "admin"`) can access all user management endpoints
357
349
-**Regular users** can only access their own profile via `GET /api/nuxt-users/:id`
358
350
-**All users** must be authenticated to access any protected endpoint
359
351
360
-
## Rate Limiting
352
+
For more details on configuring authorization, see the [Authorization Guide](/user-guide/authorization).
353
+
354
+
## Security Considerations
361
355
362
-
Consider implementing rate limiting for these endpoints:
356
+
When using these API endpoints in production:
363
357
364
-
-`/api/nuxt-users/session`: Prevent brute force attacks
0 commit comments