Skip to content

fix: Keep the org scope on the Linked accounts page and at sign-in - #141

Merged
yahyafakhroji merged 2 commits into
mainfrom
feat/sso-org-param
Sep 15, 2026
Merged

yahyafakhroji merged 2 commits into
mainfrom
feat/sso-org-param

Conversation

@yahyafakhroji

@yahyafakhroji yahyafakhroji commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Problem
Users signed in under a non-default Zitadel organization (for example staff users from the Datum Technology org) hit two dead ends. The Linked accounts page listed the default Datum Cloud org's providers and linked against them, so the staff portal still saw an unlinked account. And after the staff portal's own sign-out, the next sign-in self-healed to a login page that had dropped the organization, showing the default org's providers for a request Zitadel would only ever finalize on the staff org.

Solution
Resolve the organization from the URL, then the organization the session was signed in under, then the default-org fallback, and use it both for listing providers and for starting a link. At sign-in, keep the org scope on the self-heal redirect, and turn a session from another organization away before the callback instead of discarding it as stale.

Refs #140

@yahyafakhroji yahyafakhroji added the bug Something isn't working label Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) 🚫 cancelled
Unit Tests (component) (1) 🚫 cancelled
Unit Tests (component) (2) 🚫 cancelled

View workflow run

@yahyafakhroji yahyafakhroji self-assigned this Sep 15, 2026
@yahyafakhroji yahyafakhroji changed the title Keep the org scope on the Linked accounts page fix(sso) Keep the org scope on the Linked accounts page Sep 15, 2026
@yahyafakhroji yahyafakhroji changed the title fix(sso) Keep the org scope on the Linked accounts page fix(sso): Keep the org scope on the Linked accounts page Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

An org-pinned auth request that met a dead or cross-org cookie session
self-healed to /login without the organization, so the staff portal
landed on the default org's login page after its own logout. Zitadel
also rejects a cross-org session with the same FAILED_PRECONDITION code
as a stale grant, which pruned a valid session; the org is now checked
before the callback and the session is left intact.

Refs #140
@yahyafakhroji yahyafakhroji changed the title fix(sso): Keep the org scope on the Linked accounts page fix: Keep the org scope on the Linked accounts page and at sign-in Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

@yahyafakhroji
yahyafakhroji merged commit 8b58514 into main Sep 15, 2026
16 checks passed
@yahyafakhroji
yahyafakhroji deleted the feat/sso-org-param branch September 15, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants