You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(account): auto-redirect project login page to cloud platform SSO
Cloud-managed projects expose the control plane as a platform-SSO identity
provider (`socialProviders.objectstack-cloud`). Showing a second local
login form alongside the SSO button creates a confusing back-and-forth
between two near-identical login screens during the OAuth dance — users
report "哪个登录页才是真的".
When the project's /api/v1/auth/config advertises the `objectstack-cloud`
provider, the project's /_account/login now skips its own form entirely
and triggers `signInWithProvider('objectstack-cloud')` on mount, sending
the user straight to the cloud IdP. Returning users transit the page in
~200ms as a spinner splash, never seeing a second form.
Detection skips the auto-redirect in three cases:
1. `?fallback=1` — escape hatch for ops when the cloud IdP is unreachable,
or for legacy local-only accounts created before SSO was enabled.
2. Already-authenticated user — let the existing post-login effect navigate.
3. URL carries `client_id` + `redirect_uri` — we're inside an in-flight
oauth2 authorize hand-off on the IdP side; the previous commit's
post-login effect handles those. Re-triggering signIn would clobber the
original RP's request.
The SSO call passes `errorCallbackURL = /login?fallback=1` so a failed
cloud bounce drops the user back on the local form instead of looping the
auto-redirect.
Cloud's own /_account/login is naturally unaffected: its auth config does
not list `objectstack-cloud` (cloud is the IdP, not its own RP), so the
probe falls through and the form renders.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments