From 0577a9ccb9a1fca6bbc605771de66c67c1637bff Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 10 Nov 2026 09:17:22 +0100 Subject: [PATCH] fix(native): the hand-off page goes straight to SSO instead of TREK's login first The app's browser sign-in opens /native-handoff, which sends the user on to the identity provider by itself. The page was not on the list of public auth pages, so the 401 from loading the user sent the browser to /login with the hand-off as its return path first. On a server that also offers passwords the user then had to pick SSO a second time before getting back to the app. --- client/src/api/client.ts | 5 ++++- client/tests/unit/api/client.interceptor.test.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/api/client.ts b/client/src/api/client.ts index 64e1f97c0..bbc44e623 100644 --- a/client/src/api/client.ts +++ b/client/src/api/client.ts @@ -145,7 +145,10 @@ apiClient.interceptors.request.use( ) export function isAuthPublicPath(pathname: string): boolean { - const publicPaths = ['/login', '/register', '/forgot-password', '/reset-password'] + // /native-handoff signs the user in itself (straight to SSO when the app asked + // for it). Sent to /login by the first 401 instead, the browser showed TREK's + // own sign-in page and an SSO sign-in from the app took an extra round. + const publicPaths = ['/login', '/register', '/forgot-password', '/reset-password', '/native-handoff'] const publicPrefixes = ['/shared/', '/public/'] return publicPaths.includes(pathname) || publicPrefixes.some((p) => pathname.startsWith(p)) } diff --git a/client/tests/unit/api/client.interceptor.test.ts b/client/tests/unit/api/client.interceptor.test.ts index a28e3d21c..666a82ef2 100644 --- a/client/tests/unit/api/client.interceptor.test.ts +++ b/client/tests/unit/api/client.interceptor.test.ts @@ -1,4 +1,4 @@ -// FE-CLIENT-INTERCEPTOR-001 to FE-CLIENT-INTERCEPTOR-012 +// FE-CLIENT-INTERCEPTOR-001 to FE-CLIENT-INTERCEPTOR-015 import { describe, it, expect } from 'vitest' import { isAuthPublicPath } from '../../../src/api/client' @@ -19,6 +19,10 @@ describe('FE-CLIENT-INTERCEPTOR: 401 AUTH_REQUIRED redirect allowlist', () => { it('FE-CLIENT-INTERCEPTOR-004: /reset-password', () => { expect(isAuthPublicPath('/reset-password')).toBe(true) }) + + it('FE-CLIENT-INTERCEPTOR-015: /native-handoff, which signs in by itself', () => { + expect(isAuthPublicPath('/native-handoff')).toBe(true) + }) }) describe('prefix-match public paths — no redirect', () => {