Skip to content

[TW-4719] feat(dashboard): add org switching and session-aware org defaulting#38

Merged
AaronDDM merged 5 commits intomainfrom
ad-TW-4719-dashboard-org-switching
Mar 26, 2026
Merged

[TW-4719] feat(dashboard): add org switching and session-aware org defaulting#38
AaronDDM merged 5 commits intomainfrom
ad-TW-4719-dashboard-org-switching

Conversation

@AaronDDM
Copy link
Copy Markdown
Collaborator

Summary

After login, the CLI blindly stored the first org from the response list rather than the server's actual active org. Additionally, there was no way to switch between organizations or interactively select apps.

Changes

  • Add GET /sessions/current and POST /sessions/switch-org support in the dashboard account client
  • Add doGet/doGetRaw methods to the HTTP client for GET request support
  • Add GetCurrentSession, SwitchOrg, and SyncSessionOrg to the auth service
  • Call SyncSessionOrg after login/SSO to store the server's actual active org
  • Add nylas dashboard orgs list command to list all user organizations
  • Add nylas dashboard orgs switch command to switch the active organization
  • Make nylas dashboard apps use interactive by default (selector when called without args)
  • Enhance nylas dashboard status to show org name and total org count
  • Clear active app on org switch to prevent stale cross-org state
  • Add domain types for session and switch-org API responses
  • Add 16 unit tests for new auth service methods

Testing

  • 16 unit tests for GetCurrentSession, SwitchOrg, SyncSessionOrg
  • Manual: nylas dashboard login → verify correct org stored
  • Manual: nylas dashboard orgs list → verify org table
  • Manual: nylas dashboard orgs switch → verify org switching
  • Manual: nylas dashboard apps use → verify interactive selector
  • Manual: nylas dashboard status → verify org name shown

Related

  • TW-4719

…faulting

- Add GET /sessions/current and POST /sessions/switch-org to dashboard account client
- Add doGet/doGetRaw methods to HTTP client for GET request support
- Add GetCurrentSession, SwitchOrg, and SyncSessionOrg to auth service
- Call SyncSessionOrg after login/SSO to store the server's actual active org
- Add 'nylas dashboard orgs list' command to list all user organizations
- Add 'nylas dashboard orgs switch' command to switch the active org
- Enhance status command to show org name and total org count
- Clear active app on org switch to prevent stale cross-org state
- Add domain types for session and switch-org API responses
- Add 16 unit tests for new auth service methods
- When called without arguments, fetch apps and show interactive selector
- User can still pass app ID directly for non-interactive use
- Region is auto-detected from the selected app
@AaronDDM AaronDDM self-assigned this Mar 26, 2026
@AaronDDM AaronDDM requested a review from qasim-nylas March 26, 2026 04:11
qasim-nylas
qasim-nylas previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Collaborator

@qasim-nylas qasim-nylas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

qasim-nylas
qasim-nylas previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Collaborator

@qasim-nylas qasim-nylas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Copy Markdown
Collaborator

@qasim-nylas qasim-nylas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@AaronDDM AaronDDM merged commit 34b8c4e into main Mar 26, 2026
6 checks passed
@AaronDDM AaronDDM deleted the ad-TW-4719-dashboard-org-switching branch March 26, 2026 04:18
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.

2 participants