When you build an app with user accounts, you need to be the admin so you can manage content, configure settings, and control who has access. This article explains how admin access is assigned and what to do to claim it.
How admin assignment works
Every time Caffeine deploys your app, it generates a secret admin token and embeds it in the app. When deployment finishes, Caffeine shows you the app URL with that token included in the link. The first person to open that link and log in is recognized as the creator and automatically assigned the admin role.
The token is what proves you are the creator — not just the order in which people log in. Someone who opens your app URL without the token will be assigned the regular User role, even if they are the first to visit.
Step by step
- After a successful deployment, Caffeine displays a link to your app. Use that exact link — it contains your admin token.
- Click the link to open your app.
- Click the Login button and authenticate with Internet Identity.
- You are now the admin.
From this point on, any other user who logs in through the normal app URL will be assigned the standard User role.
The token in the URL
The admin token appears in the hash fragment of the URL, for example:
https://yourapp.icp0.io/#caffeineAdminToken=abc123...
The app reads the token as soon as you open the page, stores it in your browser session, and then removes it from the address bar. You do not need to do anything with it — just open the link and log in.
If you share the deployment link with someone else before you have claimed admin yourself, that person will become admin instead. Keep the deployment link private until you have logged in.
Promoting other users to admin
Once you are admin, you can promote any other logged-in user to admin from your app's user management panel. You can also demote admins back to users. Having multiple admins is fully supported.
Accessing admin-only features
Your app will have an admin panel or admin-only sections generated by the AI. These are accessible only when you are logged in with your admin account. Other users who try to access admin features will be turned away automatically.
Frequently asked questions
What if I log out and log back in — do I stay admin?
Yes. Your admin role is tied to your Internet Identity and persists across sessions. You do not need the original deployment link to log in again.
Can I have more than one admin?
Yes. Once you are admin, you can promote other users to admin from the user management panel.
What happens if I open my app from Caffeine after claiming admin?
The link Caffeine shows after deployment always includes the admin token, but once an admin has already been assigned the token has no further effect. Any subsequent user who logs in, with or without the token, becomes a regular User unless you promote them.
What happens to user roles when I redeploy my app?
User roles are part of your app's data and are preserved across redeployments. Existing users keep their roles. A new admin token is generated on each deployment, but it only has an effect if no admin has been assigned yet — which will not be the case after your initial claim.
I lost the deployment link before logging in. What do I do?
If you did not claim admin before the link was lost, no admin has been assigned yet. Redeploy the app from Caffeine — this generates a fresh admin token and a new link. Open that link and log in to claim admin.