Skip to content

Configuration

import { FunticoSDK } from '@funtico/gameloop-sdk';
const sdk = new FunticoSDK({
authClientId: 'your-auth-client-id', // Required
env: 'sandbox' // Optional: 'sandbox' or 'production' (default: 'production')
});
OptionTypeDefaultDescription
authClientIdstring-Your Funtico OAuth client ID (required)
envsandbox or production’production’Environment to use
  • sandbox: For development and testing
  • production: For live applications
  1. User Initiates Sign-In

    // In your login button handler
    const 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
    };
  2. User is authenticated

    // Get current user information
    const user = await sdk.getUserInfo();
    // Submit game scores
    await sdk.saveScore(1500);
    // Get leaderboard data - shows top players with their scores
    const leaderboard = await sdk.getLeaderboard();
    // Sign out when done (redirects to /login)
    await sdk.signOut('/login');