Support OAuth allowed domains for self-hosted installs
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #493 by @grootbro — closed without merging
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- authentication, authorization
Research direction
Start by locating the OAuth callback and configuration entry points, then determine how verified email domains, Google hosted-domain claims, and ALLOW_REGISTRATION are currently handled. Resolve the generic versus provider-specific configuration and signup behavior questions before implementing; done means matching users can authenticate as specified while non-matching users are rejected and existing behavior is unchanged without an allowlist.
Written by the indexing model from the issue text.
Description
Hi! Opening this as an issue first before doing another PR/rebase, as suggested in #428.
Use case
For self-hosted OpenPanel deployments, it would be useful to enable OAuth login while restricting access to members of a company domain / Google Workspace domain.
A common setup is:
- OpenPanel is self-hosted and reachable on a public URL
- Google OAuth is enabled for convenience
- public registration is disabled with
ALLOW_REGISTRATION=false - only users from an approved company domain should be able to sign in or create accounts through OAuth
At the moment, enabling OAuth does not provide a built-in domain allowlist, so operators need to rely on provider-side configuration or external controls. For Google OAuth, Workspace/internal setup is not always enough by itself for self-hosted deployments, and app-side enforcement would make the behavior clearer.
Proposed behavior
Add optional OAuth domain allowlisting:
- when no allowlist is configured, keep the current behavior unchanged
- when configured, reject OAuth callback users whose verified email domain is not allowed
- for Google, validate
email_verified, the email domain, and ideally the Google ID token hosted-domain claim (hd) for Workspace accounts - matching-domain OAuth users can sign in
- matching-domain OAuth users can sign up even when
ALLOW_REGISTRATION=false - non-matching users cannot sign in or create accounts through OAuth
Possible configuration
Generic option:
OAUTH_ALLOWED_DOMAINS=example.com,example.org
Optionally, provider-specific configuration could also be supported:
GOOGLE_ALLOWED_DOMAINS=example.com
Questions before implementation
- Would you prefer a single generic
OAUTH_ALLOWED_DOMAINSoption, provider-specific options likeGOOGLE_ALLOWED_DOMAINS, or both? - For Google, should a configured domain allowlist require the
hdclaim to match, or should verified email domain be enough? - Should matching-domain OAuth be allowed to create users when
ALLOW_REGISTRATION=false, or should the allowlist only restrict login for users that already exist?
Happy to open a fresh PR if this direction makes sense.
- Dominant language
- TypeScript
- Stars
- 7.3k
- Forks
- 552
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 18
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Openpanel-dev/openpanel
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Openpanel-dev/openpanel#694 ·
Maintainers usually reply within 1 day
-
Free trial banner overlaps the AI Chat sidebarPossibly taken @VasuS609 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Openpanel-dev/openpanel#690 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Openpanel-dev/openpanel#653 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Openpanel-dev/openpanel#610 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
Openpanel-dev/openpanel#682 ·
Maintainers usually reply within 1 day
All issues in Openpanel-dev/openpanel
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nicobailon/pi-subagents#3425 ·
Maintainers usually reply within 1 day
-
area-a2a bug port python
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
strands-agents/harness-sdk#6697 · 1 comment ·
Maintainers usually reply within 1 day
-
api technical-debt
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
opencollective/opencollective#9235 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
openwatersio/slackwater#603 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day