Phoenix Games

Overview

Client-side integration with Phoenix Games

Client Integration Overview

This section covers how to integrate Phoenix Games on the client side of your platform.

Integration Components

  • Iframe Embedding: How to properly embed game iframes with authentication
  • Events from Iframe: Handle events sent by the game to your platform
  • Events to Iframe: Send events from your platform to the game

Authentication Flow

  1. User requests to play a game on your platform
  2. Your frontend calls your backend to generate a JWT token
  3. Your backend creates the token using the player's current balance
  4. Embed the game iframe with the token as a URL parameter
  5. Handle bidirectional events between your platform and the game

Security Considerations

  • Never generate JWT tokens on the client side
  • Always validate user sessions before requesting tokens
  • Handle iframe communication securely using postMessage API
  • Validate all events received from the game iframe