• Blog
  • Documentation
  • Courses
  • Changelog
  • AI Starters
  • UI Kit
  • FAQ
  • Supamode
    New
  • Pricing

Launch your next SaaS in record time with Makerkit, a React SaaS Boilerplate for Next.js and Supabase.

Makerkit is a product of Makerkit Pte Ltd (registered in the Republic of Singapore)Company Registration No: 202407149CFor support or inquiries, please contact us

About
  • FAQ
  • Contact
  • Verify your Discord
  • Consultation
  • Open Source
  • Become an Affiliate
Product
  • Documentation
  • Blog
  • Changelog
  • UI Blocks
  • Figma UI Kit
  • AI SaaS Starters
License
  • Activate License
  • Upgrade License
  • Invite Member
Legal
  • Terms of License
    • Adding a Super Admin

Adding a Super Admin to your Next.js Supabase application

In this post, you will learn how to set up a Super Admin in your Next.js Supabase application

The Super Admin panel allows you to manage users and accounts.

Steps to add a Super Admin

Learn how to add a Super Admin to your Next.js Supabase application.

1

How to access the Super Admin panel

2

Testing the Super Admin locally

3

Assigning a Super Admin role to a user

How to access the Super Admin panel

To access the super admin panel at /admin, you will need to assign a user as a super admin. In addition, you will need to enable MFA for the user from the normal user profile settings.

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:

json
{
"email": "super-admin@makerkit.dev",
"password": "testingpassword"
}

Since you require MFA for the Super Admin user, please use the following steps to pass MFA:

  1. TOTP: Use the following TOTP generator to generate a TOTP code.
  2. Secret Key: Use the test secret key NHOHJVGPO3R3LKVPRMNIYLCDMBHUM2SE to generate a TOTP code.
  3. 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:

  1. Role: Add the super-admin role to the user in your database
  2. 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:

sql
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

Starting from version 2.5.0, the Super Admin user will be required to use Multi-Factor Authentication (MFA) to access the Super Admin panel.

Please navigate to the /home/settings page and enable MFA for the Super Admin user.

On this page
  1. How to access the Super Admin panel
    1. Testing the Super Admin locally
      1. Assigning a Super Admin role to a user
        1. Modify the auth.users record in your database
        2. Enable MFA for the Super Admin user