Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(native): the hand-off page goes straight to SSO instead of TREK's login first

Maurice0577a9ccb9a1
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', () => {