[GH-ISSUE #7520] docs: clarify wording in Admin Roles plugin section #19462

Closed
opened 2026-04-15 18:34:57 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @Anjellyrika on GitHub (Jan 21, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/7520

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

This plugin config (mirroring the docs example) causes the BetterAuthError: Invalid admin roles: superadmin. Admin roles must be defined in the 'roles' configuration.

export const auth = betterAuth({
    plugins: [
        admin({
            adminRoles: ['admin', 'superadmin'],
        }),
    ],
});

I previously had this similar config that now breaks due to a new validation #6590, and I think it's worth clarifying the specific section in the docs to reflect this change.

Current vs. Expected behavior

The docs page currently has this line:

30c275753f/docs/content/docs/plugins/admin.mdx (L755-L757)

and in a warning below it:
30c275753f/docs/content/docs/plugins/admin.mdx (L768)

which imply that you can opt out of custom access control while still having custom roles. I had been using this as a way to define a new custom role with the same permissions as admin (thus not needing to customize permissions further).

The new validation now enforces that any role in adminRoles must also exist in the custom roles, which was effectively a breaking change for my project. I suggest rewording the specific section I referenced to this:

### Admin Roles  
  
Specifies which of the built-in roles (`admin` and `user`) are considered admin roles. Defaults to `["admin"]`.  
  
**Note**: Custom roles require using custom access control with the `ac` and `roles` options. Without custom access control, you can only use the built-in `admin` and `user` roles.

What version of Better Auth are you using?

1.4.10

System info

{
  "system": {
    "platform": "win32",
    "arch": "x64",
    "version": "Windows 11 Home Single Language",
    "release": "10.0.26100",
    "cpuCount": 16,
    "cpuModel": "AMD Ryzen 7 7435HS                             ",
    "totalMemory": "19.69 GB",
    "freeMemory": "4.57 GB"
  },
  "node": {
    "version": "v24.5.0",
    "env": "development"
  },
  "packageManager": {
    "name": "pnpm",
    "version": "10.8.0"
  },
  "frameworks": [
    {
      "name": "react",
      "version": "^19.2.3"
    }
  ],
  "databases": [
    {
      "name": "mongodb",
      "version": "^6.21.0"
    }
  ],
  "betterAuth": {
    "version": "^1.4.10",
    "config": null
  }
}

Which area(s) are affected? (Select all that apply)

Documentation

Auth config (if applicable)

export const auth = betterAuth({
    plugins: [
        admin({
            adminRoles: ['admin', 'superadmin'],
        }),
    ],
});

Additional context

No response

Originally created by @Anjellyrika on GitHub (Jan 21, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/7520 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce This plugin config (mirroring the docs example) causes the `BetterAuthError: Invalid admin roles: superadmin. Admin roles must be defined in the 'roles' configuration.` ```ts export const auth = betterAuth({ plugins: [ admin({ adminRoles: ['admin', 'superadmin'], }), ], }); ``` I previously had this similar config that now breaks due to a new validation #6590, and I think it's worth clarifying the specific section in the docs to reflect this change. ### Current vs. Expected behavior The docs page currently has this line: https://github.com/better-auth/better-auth/blob/30c275753fd7a490ccadb0c707338b70ee6f0b93/docs/content/docs/plugins/admin.mdx?plain=1#L755-L757 and in a warning below it: https://github.com/better-auth/better-auth/blob/30c275753fd7a490ccadb0c707338b70ee6f0b93/docs/content/docs/plugins/admin.mdx?plain=1#L768 which imply that you can opt out of custom access control while still having custom roles. I had been using this as a way to define a new custom role with the same permissions as admin (thus not needing to customize permissions further). The new validation now enforces that any role in `adminRoles` must also exist in the custom roles, which was effectively a breaking change for my project. I suggest rewording the specific section I referenced to this: ```md ### Admin Roles Specifies which of the built-in roles (`admin` and `user`) are considered admin roles. Defaults to `["admin"]`. **Note**: Custom roles require using custom access control with the `ac` and `roles` options. Without custom access control, you can only use the built-in `admin` and `user` roles. ``` ### What version of Better Auth are you using? 1.4.10 ### System info ```bash { "system": { "platform": "win32", "arch": "x64", "version": "Windows 11 Home Single Language", "release": "10.0.26100", "cpuCount": 16, "cpuModel": "AMD Ryzen 7 7435HS ", "totalMemory": "19.69 GB", "freeMemory": "4.57 GB" }, "node": { "version": "v24.5.0", "env": "development" }, "packageManager": { "name": "pnpm", "version": "10.8.0" }, "frameworks": [ { "name": "react", "version": "^19.2.3" } ], "databases": [ { "name": "mongodb", "version": "^6.21.0" } ], "betterAuth": { "version": "^1.4.10", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Documentation ### Auth config (if applicable) ```typescript export const auth = betterAuth({ plugins: [ admin({ adminRoles: ['admin', 'superadmin'], }), ], }); ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-15 18:34:57 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Jan 21, 2026):

Thanks for bringing this to our attention! It looks like you're encountering an issue with the adminRoles configuration in the Admin Plugin of Better Auth. Based on your description, it seems like the new validation you're experiencing is directly tied to the updates made in recent versions, as discussed in the documentation and reference issues.

The documentation indicates that any roles specified in adminRoles must also exist within the custom roles if you're not using custom access control. The change you've mentioned seems to support this requirement to prevent potential role misconfigurations [1].

You suggested updating the documentation to clarify this aspect, which indeed sounds important given the breaking change. Your proposed wording adds clarity and makes it explicit that custom roles require custom access control. It’s a great suggestion!

For the next steps, I recommend creating an issue as you have done and tagging the Better Auth team to ensure they are aware and can address the documentation effectively. Tagging @bekacru and @ping__ might expedite the response regarding your proposed changes.

How are you currently handling the roles in your application? Would you like assistance with anything specific regarding this configuration?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3777108584 --> @better-auth-agent[bot] commented on GitHub (Jan 21, 2026): Thanks for bringing this to our attention! It looks like you're encountering an issue with the `adminRoles` configuration in the Admin Plugin of Better Auth. Based on your description, it seems like the new validation you're experiencing is directly tied to the updates made in recent versions, as discussed in the documentation and reference issues. The documentation indicates that any roles specified in `adminRoles` must also exist within the custom roles if you're not using custom access control. The change you've mentioned seems to support this requirement to prevent potential role misconfigurations [[1]](https://www.better-auth.com/docs/plugins/admin). You suggested updating the documentation to clarify this aspect, which indeed sounds important given the breaking change. Your proposed wording adds clarity and makes it explicit that custom roles require custom access control. It’s a great suggestion! For the next steps, I recommend creating an issue as you have done and tagging the Better Auth team to ensure they are aware and can address the documentation effectively. Tagging @bekacru and @ping__ might expedite the response regarding your proposed changes. How are you currently handling the roles in your application? Would you like assistance with anything specific regarding this configuration? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19462