Skip to main content

Game Token Response

Schema for game authentication token responses in the Intraverse Backend API v2.

Description​

The Game Token Response schema defines the structure of authentication tokens returned when users authenticate for specific games. This includes magic link tokens for game authentication.

Class Validator Schema​

import { IsString } from "class-validator";

export class GameTokenResponse {
@IsString()
public link: string;
}

TypeScript Type​

interface GameTokenResponse {
link: string;
}

Example Response​

{
"link": "https://game.intraverse.com/auth?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Field Descriptions​

FieldTypeRequiredDescription
linkstringYesMagic link URL for game authentication

Usage Example​

// Get game magic link
const response = await fetch("https://api.intraverse.io//v2/authentication/game/token/client-key", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
},
});

const result = await response.json();

if (result.link) {
// Redirect user to the magic link
window.location.href = result.link;
}

API Endpoints​

This schema is used by the following endpoints:

  • POST /v2/authentication/game/token/:clientKey - Get game magic link for client
  • POST /v2/authentication/game/token/server/:serverKey - Get game magic link for server

Authentication​

Both endpoints require:

User Authentication​

  • JWT Bearer Token: Authorization: Bearer <jwt_token>
  • Purpose: Identifies the authenticated user
  • Scope: User must have valid authentication

Game Authentication​

  • Client Endpoint: x-game-key: <client_key> header
  • Server Endpoint: x-game-server-key: <server_key> header
  • Purpose: Identifies the game/application making the request

Example Request Headers​

// For client endpoint
headers: {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"x-game-key": "your-game-client-key"
}

// For server endpoint
headers: {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"x-game-server-key": "your-game-server-key"
}

Next Steps​