Restrict github users based on profile information #1212

Closed
opened 2026-03-13 08:28:27 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jessielaf on GitHub (May 16, 2025).

Is this suited for github?

  • Yes, this is suited for github

I want to only allow github logins from a certain organization (or even certain names) or with a specific invite. We have invitations implemented manually (before betterauth had them).

Describe the solution you'd like

I would like a beforeSignIn / beforeSignUp hook. Something based on the provider. Authjs has something like this: https://next-auth.js.org/configuration/callbacks

Describe alternatives you've considered

I have considered checking it as a permission after logging in. However, this means that the users are created which I do not want to do.

Additional context

No response

Originally created by @jessielaf on GitHub (May 16, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I want to only allow github logins from a certain organization (or even certain names) or with a specific invite. We have invitations implemented manually (before betterauth had them). ### Describe the solution you'd like I would like a beforeSignIn / beforeSignUp hook. Something based on the provider. Authjs has something like this: https://next-auth.js.org/configuration/callbacks ### Describe alternatives you've considered I have considered checking it as a permission after logging in. However, this means that the users are created which I do not want to do. ### Additional context _No response_
Author
Owner

@Kinfe123 commented on GitHub (Aug 11, 2025):

You can use hooks for this

@Kinfe123 commented on GitHub (Aug 11, 2025): You can use hooks for [this](https://www.better-auth.com/docs/concepts/hooks)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1212