Repository navigation
Conversation
Self-hosted instances can already use Google, Apple and WorkOS, but none of those work with an identity provider the operator runs themselves. NextAuth already speaks OIDC, so this only declares a provider from the discovery document rather than adding a dependency or a second code path. Set OIDC_ISSUER, OIDC_CLIENT_ID and OIDC_CLIENT_SECRET to show the button; leave any of them unset and nothing changes. OIDC_NAME labels it. Email account linking matches the WorkOS provider: an operator configuring this controls the issuer and its email claim. CAP_ALLOWED_SIGNUP_DOMAINS and the block list already apply, because the signIn callback keys on the address rather than the provider.
A generic issuer is not known to verify addresses, so account linking on the email claim alone would let an issuer that accepts unverified addresses take over an existing account. The signIn callback now rejects the sign-in unless the claims carry an email and email_verified is true, which also removes the crash when an issuer omits the claim entirely and the adapter lowercases undefined. Replaces the Record<string, any> profile annotation with a declared claim type, drops the comments that only narrated the configuration, and passes the sign-in handler into NormalLogin, where the button actually lives.
|
Thanks, this looks like a clean approach. We require Greptile 5/5 on the latest commit and green CI before review, so please trigger a Greptile re-review now that account linking requires a verified email. |
|
@richiemcilroy I get a 404 when trying to retrigger. Can you retrigger for me? |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
@richiemcilroy Anything open from your point of view? Can you help me finish this PR up? |
|
Thanks @mxzinke! Greptile is at 2/5 here. We only merge once Greptile reaches 5/5, so please address its findings in the summary above (or reply to them if you think one is wrong), then comment |
|
@greptileai review |
|
@richiemcilroy Ready for review! Greptile 5/5 |
Self-hosted instances can use Google, Apple and WorkOS today, but none of those work with an identity provider the operator runs themselves. This adds a generic OpenID Connect provider.
NextAuth already speaks OIDC, so this declares a provider from the discovery document rather than adding a dependency or a second code path. Closes the gap asked about in #914.
Usage
Set all three to show the button, leave any unset and nothing changes:
OIDC_ISSUERis the base URL whose/.well-known/openid-configurationdescribes the endpoints, so any conformant provider works without further code.Scope
81 lines across five files: the env schema, the provider, the public-env flag and the login button. No new dependency, no change to existing providers, no migration.
Two decisions worth calling out:
signIncallback keys on the address rather than the provider, soCAP_ALLOWED_SIGNUP_DOMAINSand the block list cover this provider with no extra code.Deliberately not included, to keep the change small: the signup page and the share-page auth overlay keep their current buttons. New users sign in through
/loginand the account is created on first sign-in, so the flow is complete without them. Happy to add either if you would rather have them in the same PR.Testing
I do not have a working build of the monorepo available, so this is reviewed rather than built: each touched file parses, and the provider follows the shape NextAuth v4 documents for a custom OIDC provider (
wellKnownplusidToken). Please treat the CI run as the real check.

Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.Summary
Adds a generic OIDC provider for self-hosted instances.
The previous and current commits have different merge bases with the target commit, so this review used the full PR diff. No build or runtime checks were performed.
Reviews (2) · Last reviewed commit: "Merge branch 'CapSoftware:main' into fea..." · Reviewed by Greptile