Elements provides multiple ways to create and authenticate users, depending on your needs. You can use simple username/email + password logins, or integrate with third-party identity providers like Google or Steam via OIDC and OAuth2.
Authentication Methods #
1. Password Users #
The most straightforward approach: create an account with a username/email and a password.
There are two ways to create password-based users:
- Admin creation (requires SUPERUSER Session token):
- Public signup (no authentication required):
Once created, users can log in with their credentials and receive a Session token.
2. OIDC (OpenID Connect) with JWTs #
OIDC lets users authenticate with external providers (like Google) using JWTs (JSON Web Tokens).
Setup steps:
- Create an Auth Scheme for the provider:
- Give it a name (e.g.
Google). - Provide the JWK URL (JSON Web Key Set) from the provider.
- Give it a name (e.g.
- When a User tries to log in:
Key point: OIDC login requires no password handling on your end. Elements verifies identity using the provider’s JWT.
(Elements 3.9+) Rather than passing an explicit profileId or profileSelector, username/password and OAuth2 Session requests can instead pass applicationNameOrId to have Elements attach the User’s primary Profile for that Application automatically — see Sessions for details.
3. OAuth2 (Customizable) #
OAuth2 is a flexible alternative to OIDC, useful for providers like Steam that don’t offer standard OIDC.
Setup steps:
- Create an Auth Scheme:
- name (e.g.
Steam). - Validation URL (where Elements verifies the token).
- User id property (the field in the validation response that maps to a User id, e.g.
steamid). - Custom headers or query parameters (if the provider requires them).
- Specify whether parameters are:
- Sent by the frontend (dynamic, provided per login request), or
- Pre-set in the auth scheme (static, stored securely).
- name (e.g.
- Login flow:
Quick Comparison #
| Method | When to Use | Requirements | Flow |
|---|---|---|---|
| Password | Simple accounts with username/email + password | Admin token (for manual creation) OR none (for signup) | POST request to Elements; returns Session token |
| OIDC | Standard identity providers (Google, Apple, etc.) | Create Auth Scheme with JWK URL | Client provides JWT → Elements verifies → returns Session token |
| OAuth2 | Providers without OIDC (Steam, custom services) | Create Auth Scheme with validation URL, User id mapping, headers/params | Client provides token → Elements validates → returns Session token |
Best Practices #
- Use OIDC when possible — it’s simpler and more standardized than custom OAuth2.
- For password users, prefer the public signup endpoint to avoid handling SUPERUSER tokens unnecessarily.
- Keep Auth Scheme configs secure. Only expose parameters the frontend needs to send dynamically.
- Treat Session tokens like sensitive credentials — they grant access to the User’s account.

