Profile Management

User profile operations and account management

Get User ProfileGET
/api/user/profile

Get the authenticated user's profile information.

Example Request

Bash
curl -X GET "https://your-auth-server.com/api/user/profile" \
  -H "x-api-key: your-app-api-key" \
  -H "Authorization: Bearer user-token"

Response

JSON
{
  "user": {
    "id": "user_123456",
    "email": "john@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "role": "user",
    "emailVerified": true,
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:00Z"
  }
}
Update User ProfilePATCH
/api/user/profile

Update the authenticated user's profile information.

Request Body

JSON
{
  "firstName": "John",
  "lastName": "Smith"
}

Example Request

Bash
curl -X PATCH "https://your-auth-server.com/api/user/profile" \
  -H "x-api-key: your-app-api-key" \
  -H "Authorization: Bearer user-token" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Smith"
  }'
Change PasswordPOST
/api/user/change-password

Change the authenticated user's password. Requires current password for security.

Request Body

JSON
{
  "currentPassword": "oldpassword123",
  "newPassword": "newsecurepassword123",
  "confirmPassword": "newsecurepassword123"
}

Example Request

Bash
curl -X POST "https://your-auth-server.com/api/user/change-password" \
  -H "x-api-key: your-app-api-key" \
  -H "Authorization: Bearer user-token" \
  -H "Content-Type: application/json" \
  -d '{
    "currentPassword": "oldpassword123",
    "newPassword": "newsecurepassword123",
    "confirmPassword": "newsecurepassword123"
  }'
Change EmailPOST
/api/user/change-email

Change the authenticated user's email address. Verification will be sent to the new email.

Request Body

JSON
{
  "newEmail": "newemail@example.com",
  "password": "currentpassword123"
}

Example Request

Bash
curl -X POST "https://your-auth-server.com/api/user/change-email" \
  -H "x-api-key: your-app-api-key" \
  -H "Authorization: Bearer user-token" \
  -H "Content-Type: application/json" \
  -d '{
    "newEmail": "newemail@example.com",
    "password": "currentpassword123"
  }'
Security Features
  • • Password confirmation required for all password changes
  • • Current password verification for sensitive operations
  • • Email verification sent to new email addresses
  • • All profile changes are logged with timestamps
  • • User tokens are scoped to specific applications