Got it! Hier ist eine kompaktere, flüssigere englische Version, bereit zum Posten im Auth0 Forum:
Hi everyone,
I’m working on a multi-tenant app using Auth0 Organizations. When users sign up, we want to automatically create some tenant-specific resources (via an external API) and add the user to an organization with a role. This all happens through a Pre-User-Registration Action (to create a tenant ID and save it in app_metadata
) and a Post-User-Registration Action (to assign the user to the org and role via the Management API).
Everything works in principle: the user is created, the org membership is added, the role is assigned, and the metadata is stored.
However, after signup, Auth0 tries to auto-login the user. At that moment, the login fails with the error:
access_denied: The organization is not set up correctly.
No matter what we set as returnTo
(dashboard, success page, etc.), the error blocks everything. We believe this happens because the login is attempted before the Post-User-Registration Action has finished setting up the org membership, which creates a race condition.
If we force a logout after signup and ask the user to log in again manually, everything works fine. But we’d like to avoid that UX workaround if possible.
So here’s what I’m trying to understand:
- Is there an official way to delay or prevent Auth0 from auto-logging in immediately after signup?
- Why does Auth0 not respect
returnTo
after signup when the org isn’t fully set up yet? - Are we missing a cleaner way to handle user registration + org assignment without this timing issue?
Would really appreciate any insight or guidance from someone who’s solved a similar flow.
Thanks!