Adding a Super Admin to your React Router Supabase application
In this post, you will learn how to set up a Super Admin in your React Router Supabase application
The Super Admin panel allows you to manage users and accounts.
To access the super admin panel at /admin
, you will need to assign a user as a super admin.
Testing the Super Admin locally
By default, we seed the auth.users
table with a super admin user. To login as this user, you can use the following credentials:
{ "email": "super-admin@makerkit.dev", "password": "testingpassword"}
Since you require MFA for the Super Admin user, please use the following steps to pass MFA:
- TOTP: Use the following TOTP generator to generate a TOTP code.
- Secret Key: Use the test secret key
NHOHJVGPO3R3LKVPRMNIYLCDMBHUM2SE
to generate a TOTP code. - Verify: Use the TOTP code and the secret key to verify the MFA code. Make sure the TOTP code is not expired when you verify the MFA code.
These are test credentials
The flow above is for testing purposes only. For production, you must use an authenticator app such as Google Authenticator, Authy, Bitwarden, Proton, or similar.
Assigning a Super Admin role to a user
To add your own super admin user, you will need to:
- Role: Add the
super-admin
role to the user in your database - Enable MFA: Enable MFA for the user (mandatory) from the profile settings of the user
Modify the auth.users
record in your database
To assign a user as a super admin, run the following SQL query from your Supabase SQL Query editor:
UPDATE auth.users SET raw_app_meta_data = raw_app_meta_data || '{"role": "super-admin"}' WHERE id='<user_id>';
Please replace <user_id>
with the user ID you want to assign as a super admin.
Enable MFA for the Super Admin user
The Super Admin user will be required to use Multi-Factor Authentication (MFA) to access the Super Admin panel.
Please navigate to the /settings
page and enable MFA for the Super Admin user.