Skip to main content

Overview

SuperTokens Core provides comprehensive user management with support for multiple authentication methods per user, account linking, and user ID mapping for external identity systems.

User Types

Recipe User vs Primary User

SuperTokens distinguishes between two types of users:

Recipe User

A user authenticated through a single method (email/password, social login, etc.)

Primary User

A user with multiple authentication methods linked together

Creating Users

Email/Password Users

Third-Party (Social) Users

Passwordless Users

Account Linking

Making a User Primary

Before linking accounts, you must designate one as primary:

Linking Accounts

Link a recipe user to a primary user:

Account Linking Checks

From AuthRecipe.java, SuperTokens validates:
1

Primary User Validation

Ensure the primary user ID corresponds to an actual primary user
2

Recipe User Validation

Verify recipe user isn’t already linked to another primary user
3

Conflict Detection

Check for account info conflicts (email, phone, third-party ID)
4

Tenant Consistency

Verify both users share at least one tenant

Unlinking Accounts

If you unlink the recipe user that is also the primary user ID, and there are other linked accounts, the primary user will be deleted and all sessions revoked.

User Retrieval

Get User by ID

Get Multiple Users

Get User by Email

Get User by Phone Number

Get User by Third-Party Info

Pagination

List Users with Pagination

The maximum pagination limit is 500 users per request.

Updating User Information

Update Email

Update Password

Update Phone Number

User Deletion

Delete User

Deletes user and all associated data:
User deletion is permanent and cascades to:
  • All sessions
  • User metadata
  • User roles
  • Email verification tokens
  • Password reset tokens
  • TOTP devices

User ID Mapping

External User IDs

Map SuperTokens user IDs to your existing system:

Using External IDs

Once mapped, you can use external IDs in most operations:

Email Verification

Generate Verification Token

Verify Email

Check Verification Status

Unverify Email

Multi-Tenant User Management

Associate User with Tenant

Disassociate User from Tenant

List User’s Tenants

Search by Email

Search by Dashboard Tags

Active Users Tracking

Track when users were last active:
From ActiveUsers.java:15-52:
Active user tracking is updated automatically during session operations.

User Count

Best Practices

Use Primary Users

Link accounts to provide seamless multi-method authentication

Handle Edge Cases

Always check for null returns and handle exceptions

Verify Emails

Implement email verification for security

Map External IDs

Use ID mapping to integrate with existing systems

Common Patterns

Creating and Linking Users

Migrating Users with Mapping