Skip to content

fix(api,sdk): switch organizations with app token#158

Merged
markwylde merged 1 commit into
mainfrom
codex/token-org-switch-sdk
Jun 3, 2026
Merged

fix(api,sdk): switch organizations with app token#158
markwylde merged 1 commit into
mainfrom
codex/token-org-switch-sdk

Conversation

@markwylde
Copy link
Copy Markdown
Member

Summary

  • add a bearer-token POST /token/organization endpoint that verifies the current app-issued JWT, validates target-org membership, and mints fresh org-scoped tokens
  • default @darkauth/client switchOrganization() to the token switch flow while keeping authorize, hosted, and legacy silent modes explicit
  • allow registered public SPA origins to call the new token organization endpoint and update the org-switching spec
  • add focused API, CORS, and SDK test coverage for the token-switch behavior

Verification

  • Not run

Notes

  • This avoids using the same-origin/CSRF-protected session organization endpoint from cross-origin SPAs.
  • A valid existing Atlas/DarkAuth token for the same client is treated as proof the app was already authorized; DarkAuth still validates active membership before minting target-org tokens.

@markwylde markwylde merged commit 2f38d0e into main Jun 3, 2026
18 checks passed
@markwylde markwylde deleted the codex/token-org-switch-sdk branch June 3, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant