Skip to Content
Authgate 1.9.11 is released 🎉
FeaturesUser Variables

User Variables

User variables are key-value pairs stored on the server for each individual user. Unlike server-sided variables, user variables are personal to each user. They can be read and written by the user themselves through your app, and managed by you from the admin panel.

Why Use User Variables?

Store per-user data on the server instead of locally:

  • Sync across devices - Settings follow the user, not the device
  • Persist after reinstalls - Data survives app reinstalls or device changes
  • Server-side storage - Keep user-specific data secure on your server

How They Work

  • Each variable has a name (up to 64 characters) and a value of unlimited size
  • Variables are automatically created when set for the first time
  • Only authenticated users can access their own variables through the API
  • Each user has their own separate set of variables

Use Cases

Example: User Preferences

Store theme settings, language preferences, or UI customizations:

// Save user preference client.set_user_variable("theme", "dark"); // Retrieve it later (even on a different device) std::string theme = client.get_user_variable("theme");

Example: Application State

Save progress, last-used settings, or session data:

// Save current level client.set_user_variable("current_level", "5"); // Save last opened project client.set_user_variable("last_project", "project-123");

Managing User Variables from the Admin Panel

You can view and manage a user’s variables yourself from the admin panel, which is useful for support, debugging, or seeding initial data:

  1. Open the Users page and select a user.
  2. In the User Variables card you can:
    • Add a new variable with a name and value.
    • Edit a variable’s value or rename it.
    • Delete a variable.
  3. Click Save to apply your changes.

Variable names must be unique per user — saving a name that another of the user’s variables already uses will be rejected.

Setting or Deleting Variables in Bulk

When you need the same variable on many users at once — for example seeding a default, flipping a flag, or cleaning up an old key — you can do it straight from the Users page instead of editing users one by one:

  1. Open the Users page and select the users you want (or use the filters and select all matching users).
  2. Choose a bulk action:
    • Set variable - Enter a name and value to apply to every selected user. The variable is created for users who don’t have it and overwritten for users who already do.
    • Delete variable - Enter a name to remove it from every selected user. Users who don’t have that variable are left untouched.
  3. Confirm. The change runs as a background task, so large selections are processed without holding up the page.

User Variables vs Server-Sided Variables

FeatureUser VariablesServer-Sided Variables
Who sets themUsers (via your app), or you (via admin panel)You (via admin panel)
ScopePer userApp-wide
AccessOnly the ownerAll authenticated users
Use caseUser preferences, stateAPI keys, config, feature flags
Last updated on