Sign-in and link-token changes merged to Backend-API origin/development on 2026-11-23 (PR #453, branch Nov-2026/Security-Audit-&-Vulnerability-Fixes). Each item below changes what a frontend must send or what it gets back. Source of truth: Developer Guide docs/backend-api/features/authentication.md.

Tokens are bound to their user type

All Passport tokens come from one personal access client, so a portal token for dealer user 7 used to authenticate on the Admin guard as Admin user 7. ProviderBoundTokenGuard now accepts only the token names each provider issues:

Provider Accepted token names
users (Admin API) Api Token, SSO Token
dealer_users (Portal API) DAM Api Token
external_app (External API) External Api Token
external_users (external uploaders) external-token

Any other token returns 401. Broadcast channel auth (/broadcasting/auth) now accepts both api and dam-api tokens, and each channel is pinned to one guard.

Social login: one-time code instead of a token in the URL

  1. GET /api/v1/auth/login/{service} sends a random 40-character state to the provider and sets the social_login_state cookie (10 minutes, path /api/v1/auth/login, HttpOnly, SameSite lax).
  2. The callback rejects a missing or different state and redirects to /social-login?error=...&code=0.
  3. On success it redirects to /social-login?login_code=<64 chars>. The access token is cached for 120 seconds under that code.
  4. The frontend calls POST /api/v1/auth/social/exchange with { "login_code": "<code>" } and gets { "access_token": "<token>" }. The code works once. Unknown, used or expired: 422 "This sign-in link is invalid or has expired. Please try again." Limit 20 per minute.

collage-admin side (commit 30510eda): pages/social-login.vue first removes access_token and login_code from the address bar (history.replaceState), remembers the last exchanged code in useState('social_login_exchanged_code') so a re-mount never sends it twice, and posts it to auth/social/exchange. A 422 shows "Your sign-in link expired. Please sign in again.", is tracked as user login-failed with reason login_code_expired, and returns to /. The new app/utils/sensitiveUrl.ts strips access_token, login_code, token, invitation_token, code and otp from URLs sent to Amplitude and skips page views on /reset-password, /password-setup, /generate-password and /social-login.

Passkey add and remove need re-authentication

POST /api/v1/passkeys/register/options and DELETE /api/v1/passkeys/{id}:

Account Proof Failure (422)
Has a password password in the body Current password does not match.
No password (SSO JIT users) Access token issued within WEBAUTHN_REAUTH_TOKEN_MAX_AGE_MINUTES (default 10) Please sign in again to manage passkeys.

The frontend chooses the prompt from password_generated on GET /api/v1/user. Both routes and user/auth-change-password share the reauth limiter: 5 per minute per user. Enrolment challenges are bound to the user they were issued to.

collage-admin side (commit 87746fc4): on Profile, Add passkey and Remove open the new PasskeyPasswordDialog ("Verify your password") first when user.password_generated is true; otherwise the call goes out without a password and the dialog opens only if the backend asks. usePasskeyApi.getRegisterOptions(password) and deletePasskey(id, password) send the password in the body; it lives only in the dialog and is cleared when it closes. Error handling:

Backend answer UI
429 Message in the dialog, or a snackbar
422 "Please sign in again ..." Dialog switches to "Please sign in again" with a Sign in again button that logs out and reloads /
422 "Current password does not match." Opens the dialog if skipped, else shows the error under the field
422 "Passkey not found" on remove Closes the dialog, snackbar, reloads the list

The dialog closes (clearing the password) before the browser's passkey prompt appears.

Signed link tokens

Link New token Lifetime Replaces
Set-your-password (/password-setup, /subscription/generate-password) <user id>.<expires>.<hmac>, dies once a password is set 7 days md5(user id)
Admin to portal (POST /dam/v1/login-with-id, from instance.login_url) <user id>.<portal id>.<expires>.<hmac>, this portal only 12 hours md5(user id)
Single-asset share (type=...&status=single) base64 of <asset id>.<portal id or empty>.<hmac> no expiry base64(asset id)
Password reset (both APIs) unchanged random token; portal tokens now start with dlr- 60 minutes no expiry