feat(sso): single sign-on for end users from your product#4
Merged
Conversation
Bring your product's already-signed-in users straight into the feedback board with no second login. Your backend hands them off through a signed link and they arrive authenticated — ready to post, vote, and comment. For workspace owners: - A new Single Sign-On page in the dashboard (Developer -> Single Sign-On) to create and manage signing secrets, with safe rotation: create a new one, switch your product to it, disable the old one, delete when ready. - A built-in integration guide with the endpoint, token fields, and a copy-paste backend snippet to connect quickly. SSO users are always treated as end users: they can take part on the board but never reach staff or admin areas and can't change account credentials, even if their email matches a team member. A misconfigured or expired sign-in link shows a friendly notice and continues to the board instead of a raw error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds third-party product SSO so a product's already-signed-in users can reach their FeedLog feedback board without a second login. The customer's backend pre-signs a short-lived HS256 JWT and redirects the user to
GET /api/sso/jwt, which verifies the token against the org's signing secrets, finds-or-creates the end user by email, mints a host-bound session, and redirects toreturn_to. Same-domain throughout — no cross-domain hop, no one-time-token handoff.What's included
GET /api/sso/jwt— algorithm-confined HS256 verify,exprequired + 24h max-TTL cap (±60s clock tolerance), find-or-create user by email, host-only session cookie, friendly/sso/errorinterstitial on failure (logs the real reason server-side).kid). Per-org cap of 5.email,name,picture,exp), copy-paste Node signing snippet, TTL guidance.set/change-password,change-email,update-user,link/unlink-account) and from the/api/auth/organization/and/api/auth/admin/namespaces, even if the email matches an org member/owner. Staff/dashboard surfaces 403 likewise; anonymous stays 401.Design notes
email;emailVerifiedis set true so a later verified Google/password login links onto the same row rather than being locked out. Email change = new user (no history migration).ssoOrgIdsession field isinput:false(clients can't forge it) and persisted viainternalAdapter.createSessionoverride; the session-cookie value is reproduced to match better-auth/better-call byte-for-byte (WebCrypto, edge-safe).Regression testing (local, OSS single-tenant)
pnpm build, node preset) — clean; SSO routes +0005migration bundled.HttpOnlysession cookie +session.ssoOrgIdset + user created; expired / bad-signature /exp-too-far →/sso/error;return_to=//evil.com→ falls back to/.update-user,organization/list,admin/list-users, owner-only secrets API all 403 for SSO sessions; anonymous 401.nuxi typecheckare all pre-existing (the repo doesn't currently gate on typecheck;vue-tscisn't a dep); this change introduces none.