Guest accounts with Zitadel for anonymous users: when a signed token beats an anonymous session
Zitadel's guest authentication scenario gives a backend a signed token for an anonymous visitor by creating a temporary user, then using OAuth 2.0 Token Exchange (RFC 8693) with user impersonation to issue that token. A product team needs this when a visitor must have personalized state before sign-up, such as a shopping cart, saved form progress, a quote in draft or a set of preferences that the backend stores and checks on every request. A plain public access model can hold some of that state in a cookie or local storage, but the backend then has no verified identity to attach it to, and it cannot tell a legitimate session from a forged one. A signed token gives the API a subject it can validate, scope and audit, and it lets the same identity carry over when the visitor registers.
The choice comes down to what the backend must trust. If the data is harmless if anyone can read or change it, plain public access or an anonymous session is usually enough and avoids creating user records at all. If the data is tied to a customer, a price, a payment step or a regulated record, the team should prefer a token issued by the identity provider, because every temporary user then becomes an object that someone must govern. Before committing, confirm with your own architects which endpoints accept guest tokens, which scopes they carry, and whether guest users may reach any data a registered user can reach. Those answers determine the rest of the design.
This page is written for self-hosted Zitadel running in infrastructure you control, where your team owns the instance, the database and the retention rules for temporary users. The steps that follow assume you have already chosen the deployment model and have a working application and API registered in Zitadel. Check the Zitadel guest user authentication guide against the release you run, since the exact requests and settings depend on the version. Confirm the flow in a staging environment before any guest traffic reaches production.
Request flow from anonymous visit to converted account
The flow starts when a visitor triggers a high-intent action in the client app, which calls the backend. The backend sits inside the trust boundary, creates a temporary user in Zitadel, and then performs token exchange with user impersonation so it receives a signed token for that guest. The guest works with that token, and at sign-up the same user record is converted to a registered account. Check that the backend, not the browser, holds the exchange credentials and that the guest identifier survives conversion.
Anonymous visitor becomes a registered Zitadel user through a backend-brokered guest token.
Which guest account pattern fits your product
Anonymous browsing covers visitors who read public content, search a catalog or view pages without taking any action that needs a stored record. In this pattern the simplest design issues no identity at all, and the application serves public responses without a token. Guest tokens only become necessary when the backend must call protected APIs on behalf of the visitor, which is the point where a temporary user starts to matter.
- Token issuance: None for pure reads. Add a token only when a protected API must be called for the visitor.
- Data stored: No user record. Logs and rate limits may key on network data, which should be reviewed against your privacy notice.
- Conversion effort: Nothing to convert. Sign-up begins as a fresh registration.
- Abuse exposure: Public endpoints need rate limiting at the gateway, since no identity is attached to requests.
- Scale effects: Temporary users are not created for every page view, which keeps the Zitadel user table from growing with traffic.
Before you choose this pattern, confirm which endpoints truly need no identity and list every call that writes data for an anonymous visitor.
Guest carts and drafts cover visitors who build state, such as a shopping cart, a quote, a form in progress or a saved search, that must survive page reloads and ideally a later sign-up. The backend needs a stable subject to attach that state to, so a temporary Zitadel user created on the first high-intent action is a common fit. The trade-off is that each guest now owns a record that must be stored, protected and eventually removed.
- Token issuance: One token set per guest, created on the high-intent action such as adding the first item.
- Data stored: A user record plus the cart or draft rows keyed to its subject, with a creation timestamp in metadata.
- Conversion effort: Moderate. The guest subject must be linked to the registered account, and the draft data must be moved or merged.
- Cleanup need: Abandoned guests accumulate, so a pruning job based on timestamps is required from day one.
- Session handling: Decide how long the guest token lasts and how the browser recovers it after a restart.
Confirm the expected volume of abandoned carts or drafts with your own traffic data, and ask your team how merging a guest record into an account will be tested.
High-risk flows include payments, changes to personal or banking data, access to health or regulated records, and administrative actions. For these, a guest token should generally be avoided. Anonymous identity carries weak proof of who the visitor is, so a guest subject is a poor basis for authorizing money movement or access to sensitive records. The safer design requires a verified identity before the action and uses guest state only for non-sensitive steps that lead up to it.
- Token issuance: Do not issue guest tokens that authorize these actions. Require a full sign-in with the appropriate authentication strength.
- Data stored: Keep sensitive data out of guest records entirely, so pruning and conversion never expose it.
- Conversion effort: Avoided by design. Shifting the user to sign-in at the boundary is usually simpler than merging a guest record later.
- Audit trail: Actions should be attributable to a verified identity in your audit logs, which guests cannot provide.
- Passkeys and step-up: Consider a passkey or additional verification for the sensitive step rather than issuing a broader token earlier.
Ask your security and compliance teams which actions their policies classify as high risk, and confirm the answer in writing before any guest token scope is defined.
Configuration choices and when each fits
This table compares the main configuration choices for guest users in Zitadel: token lifetime, where temporary users live, token format and how metadata timestamps track activity. Read each row as a decision: the right column depends on how long a visitor stays anonymous, how many guests you expect, and how quickly you must revoke access. Confirm each setting against the Zitadel guest authentication guide before you build.
| Choice | Option and what it means | When it fits | What to confirm in the guide |
|---|---|---|---|
| Token lifetime for guest tokens | Short lifetime with silent renewal, or a longer lifetime with no renewal for one-visit sessions | Short lifetimes fit browsing sessions that may be left open; longer lifetimes fit single transactions that finish quickly | Which lifetime settings apply to temporary users and whether they can be set per application |
| Organization holding temporary users | A dedicated organization for guests, separate from workforce or customer users | Fits when guest data must be kept apart from registered customers and reporting or pruning jobs should touch only guests | How organizations and instances isolate temporary users, and whether impersonation works across organizations |
| Project holding the guest application | A project used only by the storefront or public API, with roles limited to guest scope | Fits when guest tokens should reach a narrow set of endpoints and nothing else | Which roles and grants a temporary user receives by default and how they are scoped |
| Opaque or JWT guest tokens | Opaque tokens checked by introspection, or JWTs validated locally by each backend | Opaque tokens fit when you need to revoke guest access quickly; JWTs fit high-volume APIs that check tokens without a network call | Which token type the guest application supports and the effect on introspection load (see the separate token-type topic) |
| Metadata timestamps for creation | A metadata entry recording when the temporary user was created | Fits when pruning jobs need a fixed age threshold for abandoned accounts | Whether user metadata can be written and read through the API used in the guide, and its format |
| Metadata timestamps for last activity | A metadata entry updated on each guest request or on key actions | Fits when pruning should depend on inactivity rather than age alone | How often activity writes are acceptable and whether they add meaningful API load |
| Conversion at sign-up | Linking the guest identity to a registered user, or creating a new user and migrating data | Linking fits when you want to keep the guest's cart or history; creating a new user fits when guest data is disposable | Whether the guide covers converting the same user record and what happens to tokens already issued |
Setting up guest authentication in your Zitadel instance
This sequence takes a self-hosted Zitadel from a confirmed version baseline to a working guest flow, where a backend can exchange tokens and receive signed tokens for a temporary user. Each step ends with a check so the team knows it can move on.
Confirm Zitadel and PostgreSQL versions
Your platform engineer records the self-hosted Zitadel version and the PostgreSQL version in use, then compares the PostgreSQL version against the supported range in the Zitadel database documentation. Zitadel's current supported PostgreSQL versions are 14 through 18, so any database outside that range should be upgraded or replaced before guest flows are built. Confirm the Zitadel release notes for the version you run, since token exchange and impersonation behavior should be checked against that exact release. The step is complete when the versions are written down in your change record and both fall inside documented support.
Create the guest organization and project
An administrator creates a dedicated organization to hold guest users, separate from workforce and customer users, and creates a project inside it that groups the application and its roles. Keeping guests in their own organization makes it easier to set login policies, apply cleanup rules and report on temporary accounts without touching real customer records. Record the organization ID and project ID, because the backend will reference them when it creates users. The step is complete when the organization and project appear in the console and the administrator can list the users inside the organization, which should be empty.
Configure backend client and impersonation permissions
Your identity engineer registers the backend as a machine client with the narrowest permissions it needs, typically the ability to create temporary users and to request impersonated tokens for them. Store the client secret or private key in your secrets manager, not in code or container images. Grant impersonation only inside the guest organization, so the backend cannot impersonate customers or staff. The step is complete when a test request using the backend credentials can create a user in the guest organization, and an identical request aimed at a user outside that organization is refused.
Implement temporary user creation on high-intent actions
Your application developers add logic that creates a temporary user only when a visitor takes a high-intent action, such as adding items to a cart, starting a quote or opening a saved workspace, rather than on every page view. The backend stores a metadata timestamp on the temporary user recording when it was created and when it was last used, which later drives cleanup. Pair this with rate limiting on the endpoint so anonymous traffic cannot create users in bulk. The step is complete when a high-intent action creates exactly one temporary user per visitor session and the metadata fields are populated.
Wire token exchange and impersonation
The backend calls the Zitadel token endpoint using OAuth 2.0 Token Exchange as described in RFC 8693, requesting a token that impersonates the temporary user. Zitadel's guest authentication scenario is built on this pattern, so the backend receives signed tokens for the anonymous visitor and can call downstream APIs with them. Keep the returned token in server-side storage or an httpOnly cookie, and set a short lifetime that matches the guest session. The step is complete when the backend obtains a token for the temporary user and the token is accepted by one downstream API in the test environment.
Verify impersonated token claims in a test environment
Your security or QA engineer decodes the impersonated access token and checks the subject, the organization and project context, the audience, the expiry and any role claims against the design. The check should also confirm that the impersonated token carries the guest's identity and not the backend client's identity, and that a guest token cannot reach APIs outside the intended audience. Repeat the check for an expired token and a token from a different guest to confirm isolation. The step is complete when the test results are recorded and every claim matches the expected values.
Test conversion and cleanup before release
Before the flow reaches production, the team tests conversion, where a guest completes sign-up and the temporary user is linked to a permanent account, and tests the cleanup job that removes abandoned guests using the metadata timestamps. Confirm the cleanup job skips accounts that have converted and that every deletion is logged. The step is complete when a converted guest keeps its data, an abandoned test guest is removed by the job, and the audit log shows both outcomes.
Converting a guest into a registered user without losing data
The core task in converting a guest is linking the temporary user that already holds the visitor's activity to a permanent account at sign-up, so the data the guest created is not orphaned. Zitadel's guest pattern creates a temporary user and issues tokens for it through token exchange and impersonation, so the conversion design starts with a decision: whether the guest user record is promoted in place, or whether a new registered user is created and the guest's data is re-associated with it. Promotion in place keeps the user ID stable, which keeps every reference in your application valid. A new user requires a merge step in your own data layer. Confirm with your Zitadel setup which of these the registration flow supports, and whether the temporary user can be given full login credentials without being recreated.
Before you ship, map everything keyed to the guest identity: carts, drafts, uploads, consent records, audit entries and any role or grant assigned to the temporary user in its project. Each of these must either move with the user ID or be rewritten during the merge. Confirm three conversion details in a test environment: that the guest's sub value is unchanged or that your application stores a mapping from the old ID to the new one, that grants and project roles attached to the guest are carried over or intentionally removed, and that a guest who signs up with an email address already in use is handled as a duplicate rather than merged silently. Federated sign-up adds a second path. If the visitor chooses a social or enterprise identity provider, the external identity must be linked to the same Zitadel user, and the linking rule should be tested for both the first sign-up and a later sign-in from another provider.
Passkey registration is the last step to test. A guest who registers should be able to add a passkey, which Zitadel supports with fallback to password login, but passkey enrollment usually requires an authenticated session. Verify that the session created for the guest can be upgraded to a full login without a second visible prompt, and that the old guest tokens are revoked or stop being accepted by your APIs once the conversion completes. Document the rollback path as well: if the merge fails halfway, the guest's data must remain reachable so the visitor is not left with neither an anonymous session nor an account. Ask your implementation team to write these checks as acceptance tests before the flow goes live, because the conversion is the point where the most user data is at risk.
Security risks of issuing tokens to anonymous visitors
Issuing real tokens to visitors who have not signed up turns every guest session into an identity your backend must trust. The risks below share one root: a guest token is cheap to obtain, so limits on creation, privilege, lifetime and logging have to be set deliberately before launch.
Bots creating unlimited temporary users
If guest creation is open to any caller, a script can mint temporary users in a loop and fill your instance with records that look like people. Each one consumes storage, token issuance and directory space. Before launch, decide which high-intent actions justify a guest, set per-IP and per-client limits at the edge, and confirm how Zitadel behaves under request floods in your own load test. Ask the vendor which rate limiting controls are available in your deployment version.
Impersonation permissions over-granted
Token exchange with user impersonation lets a backend act as a guest. If the service account that performs it holds broad administrator roles, any bug or leaked credential in that backend can impersonate any user, not only guests. Grant the impersonation permission to a dedicated service account, scope it to the guest organization, and test that it cannot read or change accounts outside that boundary.
Guest auth guideGuest tokens reaching data they should not
A guest token is still a valid token, so each API it reaches must decide what a temporary user may see. Project roles and grants that were designed for registered customers can quietly apply to guests. Map which resources guests need, grant only those roles, and check each protected API for audience and role checks. Run a test in which a guest token calls every endpoint a registered user can reach.
Token lifetime and revocation
Anonymous sessions often outlive the visit that created them, and a long-lived token for an unknown person is hard to justify. Set short access token lifetimes for guests, decide whether APIs validate tokens locally or through introspection, and confirm how quickly a revoked or expired guest is refused. The trade-off between offline JWT validation and immediate revocation should be written down before go-live.
Audit logging of impersonated actions
When a backend acts on behalf of a guest, the log must show both the impersonating service account and the guest user, or investigators cannot tell who did what. Confirm which events Zitadel records for token exchange and impersonation, and forward them to your log platform with retention that matches your policy. Without this, abuse by a compromised backend is almost invisible.
Masterkey and backend secrets
The backend that exchanges tokens holds a client secret or private key with power to mint identities. The Zitadel masterkey protects data at rest, so losing or exposing it has consequences beyond guest accounts. Store the masterkey and service account keys in a secrets manager, restrict who can read them, and plan rotation. Ask your team to confirm the rotation procedure for both before the first guest is issued.
Pruning abandoned guest accounts with metadata timestamps
Guest users are cheap to create, so without a cleanup rule they accumulate quickly. The core decision is to record two timestamps on every temporary user: when the guest was created and when it was last seen. Store both as user metadata in Zitadel so the values travel with the account and can be queried later, instead of relying on session data in your application. Use the last-seen value only if your backend updates it on each authenticated request, and agree on the write frequency so that a busy guest does not cause excessive API calls. Keep the metadata keys and value format (for example, UTC timestamps in a fixed format) in a documented schema that your application and cleanup job both use.
A scheduled job then finds guests whose last-seen timestamp is older than your retention window and removes them through the Zitadel API. Run it first in report-only mode against a copy or a staging instance, and review the candidate list for false positives, such as guests who converted to registered accounts but still carry the temporary flag. Filter on the guest marker and on the creation timestamp as well as last-seen, so a missing or malformed value never causes a deletion. Log each candidate and each deletion with the user identifier and the reason, and confirm how the API paginates results so the job does not skip accounts on large instances. Check how deletion behaves in your Zitadel version, including whether it is immediate, whether associated grants and sessions are removed, and whether any data can be recovered.
Before automating any deletion, confirm three things with Zitadel and your privacy team: the retention period that applies to anonymous visitors in each jurisdiction you serve, whether deleting a user fully erases personal data or leaves traces in logs and audit records, and who approves the job's scope and changes. Record the answers in your data retention documentation so that a later audit can trace each rule to a decision. Treat the job as a control that needs its own tests and monitoring, because an error here removes accounts that users expect to keep.
Limits to confirm before you commit
A guest flow touches version support, API throughput, licensing, concurrency and audit trails at the same time. Each card below names one thing to confirm in your own environment before you design around it, and the answers will change the build.
Version support for the guest scenario
The guest authentication pattern depends on temporary user creation, Token Exchange (RFC 8693) and user impersonation working together in the release you deploy. Confirm that every component in that chain is supported in the Zitadel version you plan to run, not only in the current release. Check the version against the guest authentication guide before you pin it, and retest after each upgrade because the flow crosses several API surfaces.
Guest auth guideAPI limits for bulk user creation
Every anonymous visitor who triggers a high-intent action creates a user, so a traffic spike becomes a burst of user-creation calls. Ask the vendor and your own load test what request rates the deployment sustains and whether any limit is configurable on your self-hosted instance. Your backend should queue or throttle creation rather than assume the API absorbs a spike without errors.
How temporary users count toward limits
Pricing on the Zitadel pricing page is expressed in daily active users, so temporary guest accounts may count toward plan limits if they sign in. Ask whether a guest that receives a token but never registers is counted, and how that changes under a Free or Pro plan. Self-hosted deployments have no vendor plan limit, but the Enterprise terms and support scope should still be confirmed in writing.
Zitadel pricingBehavior under high concurrency
Concurrent guest creation, token issuance and pruning jobs compete for the same PostgreSQL database and Zitadel instance. Test with realistic anonymous traffic rather than sequential calls, and watch for duplicate user creation when two requests from one visitor race. Confirm the database version and connection pool sizing you will run, because the database is the most likely bottleneck.
Database requirementsAudit attribution for impersonated sessions
When your backend acts as a guest through impersonation, the audit trail must show who performed the action and which account it acted for. Confirm whether Zitadel logs impersonated sessions under the impersonated guest identity, the backend service identity, or both. If the logs do not preserve the acting service, add your own correlation fields in your application logs before you rely on them for investigations.
Questions teams ask before building guest accounts
How much effort does a guest account implementation take?
Effort depends mostly on how many entry points create guests, how many backends must accept the impersonated tokens, and how much existing sign-up logic you need to reuse. A single high-intent action wired to one backend is a much smaller job than a guest flow spanning several web and mobile clients. The main work items are the guest creation path, the token exchange and impersonation setup in Zitadel, conversion at sign-up, and the cleanup job. Ask any partner to break the effort into those four parts so you can see which ones your team already owns and which need outside skills.
Can our team build guest accounts without outside help?
Yes, if your engineers have working experience with OAuth 2.0 and OpenID Connect, can operate a self-hosted Zitadel instance, and can change your backend's token validation. The guest pattern relies on OAuth 2.0 Token Exchange (RFC 8693) and user impersonation, which are less common than standard login flows, so review the Zitadel guest user authentication guide with your security reviewers before deciding. Outside help is most useful for threat modeling who can impersonate whom, for testing the token boundaries, and for documenting controls for your compliance team.
What does the work need from our identity and backend engineers?
Identity engineers own the Zitadel side: the instance and organization layout, the service account used for token exchange, the permissions that allow impersonation, and the rules for when a temporary user may be created. Backend engineers own token validation, mapping guest identities to the resources they may read or write, and making sure guest tokens cannot reach admin or billing endpoints. Both teams need to agree on claims, token lifetimes and the event that converts a guest into a registered user. Plan time for those reviews before coding starts.
How long does it take to reach a tested release?
The duration depends on scope, including the number of clients, the backends that accept guest tokens, your test environments and the review your security team requires. No fixed timeline applies across those variables, so ask for a written plan that lists phases, test gates and dependencies before you commit. Any DeployOpen engagement is fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. Compare plans on what each phase delivers and how it is tested, not on the headline length.
Do guest users count toward Zitadel plan limits?
Check this with Zitadel before you design around it. The Zitadel pricing page lists plans by daily active users, including a Free plan with 100 daily active users and a Pro plan with 25,000 daily active users, so temporary users who sign in through the guest flow may count toward those figures. Confirm how Zitadel counts users that are created but never log in interactively, and how impersonated sessions are counted, before you estimate volume. Self-hosted deployments have their own capacity planning, which your engineers should size separately from any cloud plan.
How is cleanup of abandoned guest accounts governed?
Governance means a written retention rule, a job that enforces it, and evidence that the job ran. A common approach stores a creation timestamp and last-activity timestamp in user metadata, then a scheduled process deletes or disables guests that exceed the rule. Decide the retention period with your privacy and legal teams, log each deletion, and confirm that deleted guests cannot keep active sessions or tokens. Ask your partner to test the job against a copy of production data and to document who may change the retention setting.
What security checks should we run before launching guest tokens?
Start by confirming that a guest token grants only the narrow scopes and roles the guest flow needs, and that no impersonation path reaches administrative APIs. Test token expiry, revocation behavior and how backends reject tokens from unexpected issuers or audiences. Record the results so your security and compliance reviewers can trace each control to a test. Security testing of the application and its APIs is a separate piece of work that DeployOpen can scope on its own.
How DeployOpen scopes and delivers guest account work
DeployOpen plans, builds, tests and documents guest account flows on a self-hosted Zitadel instance inside infrastructure you control. Each engagement starts from a written scope covering the guest trigger, token exchange path, conversion rules and cleanup policy, so your team knows what is delivered before work begins.
How we scope
- Map which high-intent actions create a temporary user and which must stay anonymous.
- Define the Zitadel instance, organization and project layout that will hold guest users.
- Agree in writing how guest tokens are issued, which backends accept them and what they can access.
- Record the conversion rules at sign-up and the retention window for abandoned accounts.
- Engagements are fixed-scope, with deliverables and timelines agreed before work starts.
How we build
- Configure the backend token exchange and impersonation flow against your self-hosted Zitadel.
- Set metadata timestamps on temporary users so pruning jobs can identify abandoned accounts.
- Implement the conversion path that links a guest record to a registered account at sign-up.
- Test token claims, scopes and expiry for guest sessions before any production traffic reaches them.
- Test that guest tokens cannot reach registered-user resources or administrative APIs.
How we hand over
- Document the guest flow, token claims, service accounts and configuration keys used by your teams.
- Provide the pruning job with its schedule, criteria and logs so operators can review each run.
- Deliver test evidence for conversion, impersonation limits and cleanup behavior.
- Walk your engineering and security teams through the runbook and open questions before closing.
- Confirm with your own environment which Zitadel version and PostgreSQL version the handover covers.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers.
- Review guest flows again when Zitadel releases upgrades or your sign-up journey changes.
- Re-run abuse and retention tests after changes to rate limits, storage or pruning criteria.
- Keep the runbook current with configuration changes made by your team after handover.
- Agree the support scope, response expectations and upgrade cadence in writing at the start.

