Get User Info (Game Client)
Retrieve the authenticated user's profile, roles, and organizations from a game client.
Endpoint
GET /api/v2/user/game
Authentication
This endpoint requires both the game client key and the user's JWT token (with scope: "game"):
x-game-key: your-game-client-key
Authorization: Bearer user-jwt-token
The JWT token is the idToken received during the magic login flow.
Request Example
curl -X GET https://api.intraverse.io/api/v2/user/game \
-H "x-game-key: your-game-client-key" \
-H "Authorization: Bearer eyJhbGciOi..."
Response
Success Response (200)
{
"user": {
"id": "user-abc-123",
"username": "cool-panda-42",
"email": "user@example.com",
"referralCode": "ABC123",
"referredBy": "user-xyz-789",
"referrer": "another-player",
"skipReferral": false
},
"roles": [
{
"id": "role-1",
"name": "Player",
"isSuperAdmin": false,
"permissions": [
{
"key": "game.play",
"name": "Play Game",
"description": "Can play the game"
}
]
}
],
"organizations": [
{
"id": "org-1",
"name": "Intraverse",
"isMain": true
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
user | object | User profile |
user.id | string | Unique user ID |
user.username | string | Display name |
user.email | string? | Email address (may be absent) |
roles | array | Roles assigned to the user |
organizations | array | Organizations the user belongs to |
Error Responses
| Code | Message | Description |
|---|---|---|
| 401 | Unauthorized | Missing or invalid JWT token |
| 401 | Invalid scope | Token does not have game scope |
| 401 | Missing client key | x-game-key header not provided |
| 404 | Game not found | Client key does not match any game |
| 404 | User not found | User ID from token not found |
Usage Example
const response = await fetch("https://api.intraverse.io/api/v2/user/game", {
method: "GET",
headers: {
"x-game-key": gameClientKey,
Authorization: `Bearer ${idToken}`,
},
});
const { user, roles, organizations } = await response.json();
console.log(`Logged in as: ${user.username}`);