Users
user profile
Get User Profile
Retrieve the profile information of the authenticated user.
Endpoint
Authentication
This endpoint requires authentication using a JWT token.
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | Bearer token (JWT) obtained from /auth/signin |
Example:
Request
No request body is required for this endpoint.
Response
Success Response
Code: 200 OK
Content example:
Field | Type | Description |
---|---|---|
id | string | User’s unique ID |
string | User’s email address | |
fname | string | User’s full name |
phone | number | User’s phone number |
Error Response
Code: 401 UNAUTHORIZED
Content example:
Notes
- This endpoint is protected by JWT authentication (JwtAuthGuard).
- The user’s profile is retrieved based on the user ID encoded in the JWT token.
- Ensure that the token is not expired.
Example Usage (JavaScript Fetch API)
Security Considerations
- Always use HTTPS to prevent token interception.
- Implement token expiration and refresh mechanisms.
- Validate and sanitize any user input if you extend this endpoint to accept query parameters.
- Implement proper error handling on the client side to manage token expiration or invalidation.
- Ensure that the server only returns information that the authenticated user is authorized to access.