[GRO-2572] fix: SSO button follows Better Auth redirect URL #91
Reference in New Issue
Block a user
Delete Branch "fix/gro-2572-sso-redirect"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the dead "Sign in with SSO" button on
/login. Better Auth'ssignIn.social()returns the IdP authorize URL indata.url(withredirect: true) rather than issuing an HTTP 30x. The handler never readdata.url, so users stayed on/loginwith no navigation.Root cause:
handleSocialLogininLoginPage(App.tsx:41) did not followresult.data.urlafter callingsignIn.social().Fix:
result.data.urland setwindow.location.hrefto it on success.returnin the error branch to prevent fall-through.Files changed
src/App.tsx—handleSocialLogin: follow redirect URL from Better Auth responsesrc/__tests__/App.test.tsx— GRO-2572 regression test: mockssignIn.socialreturningdata.urland assertswindow.location.hrefis setUAT_PLAYBOOK.md— §5.4.1 TC-WEB-SSO-2 updated: require fresh/incognito context (stale auth cookie masks the defect, which is how Shedward's PASS occurred despite the broken button)Test results
All 199 tests pass (15 test files).
UAT Playbook
Updated UAT_PLAYBOOK.md §5.4.1 TC-WEB-SSO-2 — requires running TC from a clean browser context (incognito/private window with no prior auth cookie).
Better Auth's signIn.social() returns { data: { redirect: true, url } } rather than issuing an HTTP 30x when using the fetch client. The LoginPage handler was discarding data.url, so the SSO button appeared to do nothing (the button disabled but the user never left /login). Fix: after the social sign-in call, if result.data.url is present, navigate via window.location.href. Also add an early return in the error branch so the two paths don't bleed into each other. Updated UAT_PLAYBOOK.md §5.4.1 TC-WEB-SSO-2 to require a fresh/incognito context so a stale auth cookie can't mask the regression. Co-Authored-By: Paperclip <noreply@paperclip.ing>