Skip to main content

GET /api/auth/profile

Retrieves the profile information for the currently authenticated user.

Authentication

Requires valid authentication. The user ID is extracted from the JWT access token in the request.

Request Body

No request body required.

Response

user
object
The user’s profile information.
user.id
string
Unique user identifier.
user.email
string
User’s email address.
user.username
string
User’s username.
user.role
string
User’s role (“user” or “admin”).
user.wallet
string
User’s TRON wallet address.
user.createdAt
string
ISO 8601 timestamp of when the account was created.
user.lastLogin
string
ISO 8601 timestamp of the user’s last login.

Example Request

GET /api/auth/profile
Cookie: accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response

{
  "user": {
    "id": "507f1f77bcf86cd799439011",
    "email": "[email protected]",
    "username": "johndoe",
    "role": "user",
    "wallet": "TRX7qS7n9qJCyXPZp3nYbH6KdQ3fPgDq8f",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "lastLogin": "2024-03-04T14:22:00.000Z"
  }
}

Error Responses

error
string
Error message describing what went wrong.

401 Unauthorized

  • Missing or invalid access token

404 Not Found

  • User not found - The user ID from the token doesn’t match any existing user

500 Internal Server Error

  • Server error with error message details

Notes

  • This endpoint requires authentication middleware to populate req.user.id (see ~/workspace/source/src/api/auth/getProfile.js:5)
  • The wallet address returned is only the public address, not the private key
  • Password information is never returned in the response
  • Sensitive fields like twoFactorSecret and wallet.privateKey are excluded from the response
  • The lastLogin field may be null if the user has never logged in (only registered)

Build docs developers (and LLMs) love