Configuration
Basic Setup
Section titled “Basic Setup”import { FunticoSDK } from '@funtico/gameloop-sdk';
const sdk = new FunticoSDK({ authClientId: 'your-auth-client-id', // Required env: 'sandbox' // Optional: 'sandbox' or 'production' (default: 'production')});Configuration Options
Section titled “Configuration Options”| Option | Type | Default | Description |
|---|---|---|---|
authClientId | string | - | Your Funtico OAuth client ID (required) |
env | sandbox or production | ’production’ | Environment to use |
Environment Setup
Section titled “Environment Setup”- sandbox: For development and testing
- production: For live applications
📖 Step-by-Step Explanation
Section titled “📖 Step-by-Step Explanation”-
User Initiates Sign-In
// In your login button handlerconst handleLogin = async () => {await sdk.signInWithFuntico(window.location.href);// User is now redirected to Funtico authentication and after he logs in he will be redirected to the page where he clicked the login button}; -
User is authenticated
// Get current user informationconst user = await sdk.getUserInfo();// Submit game scoresawait sdk.saveScore(1500);// Get leaderboard data - shows top players with their scoresconst leaderboard = await sdk.getLeaderboard();// Sign out when done (redirects to /login)await sdk.signOut('/login');