Skip to content
EN

Auth & Session

These endpoints require a user session (a signed-in browser or its JWT). Room API tokens cannot call them; a personal API key may call only GET /api/users/me.

GET /api/auth/token

Exchanges the OIDC session cookie for a short-lived bearer JWT.

{ "token": "<jwt>" }
POST /api/auth/refresh

Refreshes the OAuth session. The app calls this automatically.

GET /api/session

Returns information about the current session (user, expiry).

POST /api/auth/user
Authorization: Bearer <jwt>

Creates or updates the user profile from the JWT. Side effect: accepts any pending room invitations matching the user’s email and adds them to those rooms.

GET /api/users/me
GET /api/users/me/rooms

GET /api/users/me returns the profile plus a rooms array; GET /api/users/me/rooms returns the rooms the user belongs to with userRole and counts.

{
"user": {
"userId": "auth0|123456",
"email": "user@example.com",
"name": "John Doe",
"createdAt": 1700000000000,
"lastLogin": 1700000000000
},
"rooms": [{ "roomId": "aB3dEfGhIj", "name": "Survey 2026", "memberRole": "owner" }]
}

With a personal API key (read), GET /api/users/me answers { "user": { "userId", "username", "plan" }, "rooms": [...] } — never your email — and lists only the rooms on the key’s list if it has one. GET /api/users/me/rooms stays session-only.