fix(auth): allow anonymous access to share-link endpoints (#1617)

The global Auth middleware allowlist (noAuthAPI) was missing the
share-link routes, so an unauthenticated invitee opening /register?token=
hit a 401 on /auth/invitations/lookup and the frontend bounced them to
/login instead of showing the register page. Add both share-link
endpoints to the allowlist and stop the request interceptor from treating
their 401s as a session-expiry redirect.

Refs: https://github.com/Tencent/WeKnora/issues/1617
This commit is contained in:
wizardchen
2026-06-05 18:44:05 +08:00
committed by lyingbug
parent 946ff5557a
commit b820e690f0
2 changed files with 23 additions and 10 deletions
+6 -1
View File
@@ -63,7 +63,12 @@ instance.interceptors.request.use(
let isRefreshing = false;
let failedQueue: Array<{ resolve: Function; reject: Function }> = [];
const PUBLIC_AUTH_PATHS = ['/auth/auto-setup', '/auth/login', '/auth/register', '/auth/oidc/'];
// Share-link endpoints (/auth/invitations/lookup, /auth/register-by-invite)
// are reachable by anonymous users opening an invite link. A 401 from these
// must surface to the page (e.g. expired token), not trigger the
// refresh-then-redirect-to-login flow (issue #1617). '/auth/register' already
// covers '/auth/register-by-invite' via substring match.
const PUBLIC_AUTH_PATHS = ['/auth/auto-setup', '/auth/login', '/auth/register', '/auth/oidc/', '/auth/invitations/lookup'];
function isPublicAuthRequest(url?: string): boolean {
if (!url) return false;