• Hook to interact with the ID Server and handle redirects for Steam, TikTok, and YouTube authentication.

    This hook provides methods to initiate authentication flows for Steam, TikTok, and YouTube. These methods use the ID Server configured via the PlayMakersProvider context.

    Returns any

    The returning object contains:

    • redirectSteam: redirect methods for Steam
    • redirectTikTok: redirect methods for TikTok
    • redirectYouTube: redirect methods for YouTube

    Implementation Details

    • Config-Driven Base URL: The base URL for the ID Server is derived dynamically from the PlayMakersProvider configuration, ensuring flexibility for different environments.
    • Shared Callback Logic: Each platform-specific redirect method shares common callback URL logic, defaulting to /quests or /quests/{questId} if provided.
    • API Integration: The call method abstracts API request logic, ensuring all requests are POSTed to the appropriate endpoint with standardized payloads.
    • Error Handling: Errors encountered during API calls are propagated to the caller to enable context-specific handling.

    Example

    import { useIdServer } from 'react-playmakers';

    const MyComponent = () => {
    const { redirectSteam, redirectTikTok, redirectYouTube } = useIdServer();

    const handleSteamRedirect = async () => {
    await redirectSteam('qXXXXXXX'); // Pass questId as an argument
    };

    return (
    <button onClick={handleSteamRedirect}>
    Authenticate with Steam
    </button>
    );
    };

Generated using TypeDoc