Skip to main content

Setting up PlayFab Authentication using Anonymous Login

This guide shows you how to implement PlayFab authentication using anonymous login APIs with server-side protection, focusing only on CustomID authentication using HTML5/JavaScript.

Overview

On June 30, 2025, all newly created titles will have player creation via anonymous APIs disabled.
To enhance the security of anonymous login, PlayFab implemented a crucial security feature that separates player creation capabilities between client-side and server-side APIs.
  1. Disabled Client-Side Player Creation:
    • For newly created titles, all anonymous login APIs on the client side (LoginWithCustomID, LoginWithAndroidDeviceID, LoginWithIOSDeviceID, LoginWithNintendoSwitchDeviceId) no longer automatically create new player accounts. Titles created before June 30, 2025 can disable anonymous login through Game Manager configuration.
    • Disabling client-side player creation prevents unauthorized account creation directly from unauthorized clients.
    • Only existing players can log in through client-side APIs.
  2. Enabled server-side player creation:
    • Player account creation is now handled through server-side APIs (LoginWithCustomID, LoginWithAndroidDeviceID, LoginWithIOSDeviceID, LoginWithNintendoDeviceId).
    • This ensures all account creation happens in a secure, controlled environment.

Prerequisites

  • A unique identifier for the player (CustomID)
  • A registered PlayFab title
  • Your PlayFab title’s secret key
  • Familiarity with sign-in basics and best practices
  • A server with a valid domain name to serve static HTML files
If you need help with setting up a server, see the Running an HTTP server for testing tutorial. Throughout this guide, we’ll assume your domain is http://playfab.example.

Authentication flow

  1. Server-side account creation:
  2. Client-side Login:

Implementation steps

1. Set up your development environment

  1. Download the JavaScript SDK from the JavaScript SDK documentation
  2. Install the required Node.js packages:

2. Server-side implementation (Node.js)

Keep your title secret key secure and never expose it in client-side code. The secret key should only be used in secure server environments.

3. Client-side implementation (HTML)

Configuring player creation settings

For existing titles

  1. Navigate to the PlayFab developer portal and select your title
  2. Go to Settings.
  3. Select the API Features tab.
  4. Check the box to prevent new player accounts from being created via anonymous login APIs

For new titles

Enabling automatic player creation for anonymous login APIs can compromise security. Only enable this feature temporarily during development or testing. Always disable it before moving to production.
New titles have player creation via anonymous APIs disabled by default. To enable for testing, perform the following:
  1. Navigate to the PlayFab developer portal and select your title
  2. Go to Settings.
  3. Select the API Features tab.
  4. Uncheck the box to allow new player accounts from being created via anonymous login APIs

Testing and response examples

Server response example

When successfully creating a user through the server API, you receive a response similar to:

Client response example

When attempting to create a new account from the client API (which is now disabled), you receive an error:
When successfully logging in an existing user through the client API:

Further reading

Last modified on August 10, 2026