Skip to content

Week 39 · 21 – 27 September 2026 ​

The headline is Custom Token Exchange: a backend you trust can sign a token for one of its users and trade it at /oauth/token for AuthHero tokens, Auth0-compatible and with a no-code mode Auth0 does not have. It ships with a migration that must run before the new version serves traffic. Two fixes deserve an upgrade on their own. The client IP that keys the login rate limiter could be chosen by the caller, by sending a header. And on Cloudflare Workers, concurrent requests in one isolate were sharing adapter state, which surfaced in production as requests the runtime cancelled for having "hung". The login pages picked up organization branding and a way to switch between password and emailed code, and tenant-member invitations can now email themselves.

Custom Token Exchange ​

Some sign-ins never pass through a browser redirect: a legacy system you are migrating off, a partner that already authenticated the user, a backend acting for a user it knows. Custom Token Exchange covers that. The backend presents a subject token at /oauth/token with the token-exchange grant and a subject_token_type you define, and gets AuthHero tokens for the user back. It returns tokens only — no browser session and no refresh token.

A token exchange profile claims one subject_token_type and decides who the exchange is for, in one of two ways:

  • An action, on the new custom-token-exchange trigger. The action inspects the subject token and calls api.authentication.setUserById or setUserByConnection, or refuses with api.access.deny or api.access.rejectInvalidSubjectToken. This is the Auth0-compatible mode, and an Auth0 action written for it carries over.
  • Declarative JWT verification, an AuthHero extension that needs no code. The profile names a jwks or jwks_uri, and the server checks the signature (asymmetric algorithms only), an exact iss, the aud, a bounded lifetime and a single-use jti, then maps the token to an existing user or to <strategy>|<sub> in a connection, optionally creating the user. The token's email_verified is copied onto a new user only if the profile sets trust_email_verified.

An application opts in with token_exchange.allow_any_profile_of_type: ["custom_authentication"] and must be first-party; a confidential application must authenticate. Invalid subject tokens are logged with the reason and count towards the brute-force rate limit, so a guessing client is answered with 429.

Profiles are managed at /api/v2/token-exchange-profiles and on a new page in the admin UI, which also gained the application toggle and the new trigger.

Run the migrations first. The kysely and drizzle adapters each add a token_exchange_profiles table and a token_exchange column on clients, and every client read touches the new column — so the new version fails against a database that has not been migrated. Not included yet: refresh tokens, caching of a remote jwks_uri (it is fetched on every exchange), and tenant export/import of profiles.

The client IP can no longer be forged ​

Security fix. When a request arrived through a proxy, the server took the client IP from the first entry of X-Forwarded-For. That entry is whatever the caller sent: the proxy preserves the inbound chain and only appends the hop it verified. The IP keys the pre-login rate limiter and its allowlist, and the check that a passwordless code is redeemed from the address that requested it — so a scanner could pick its own rate-limit bucket, or claim an allowlisted address, with one header.

The IP now comes from CF-Connecting-IP (unless it holds one of Cloudflare's own addresses, as it does on a worker-to-worker hop), then X-Real-IP, then the last X-Forwarded-For entry. Refresh-token device records use the same derived value.

This can change the IP you see. A deployment behind a proxy that is not Cloudflare and sets only X-Forwarded-For now gets the last hop rather than the first. And one gap is left open: with nothing in front of the server at all — plain Node or Docker — those headers are still caller-controlled, so put a proxy you control in front of it.

On Workers, requests no longer share adapter state ​

If you run AuthHero on Cloudflare Workers and have seen The Workers runtime canceled this request because it detected that your Worker's code had hung, this is likely why. Workers hand the same env object to every request in an isolate, and the server stored each request's adapter stack on it. Concurrent requests overwrote each other's stack, so one request could end up waiting on another request's in-flight work; when that other request finished, the wait could never complete and the runtime cancelled it. In production it showed up on /authorize, /oauth/token and logout, often within a few hundred milliseconds, and behind the proxy as service_binding_timeout 504s.

The server now copies env per request before writing to it. Nothing to configure.

Login page changes ​

  • Organization branding applies. Organizations have always stored a logo, a primary colour and a page background, and the login pages never read them. A login started with organization now layers the organization's branding over the tenant's, as Auth0 does; anything the organization leaves unset falls back to the tenant.
  • Switch between password and code. A tenant offering both sends a returning user to the method they used last, and on /u2 there was no way out of it. In the identifier-first flow, the password screen now offers "Log in with a code" and the code screen offers "Log in with password" when the user has one. The code button does not reveal whether an account exists: an unknown address gets a code only if it could have signed up.
  • connection=email without a hint asks for the address. An /authorize request naming the email connection but carrying no login_hint could fall through to a password screen, based on tenant settings or the user's last method. It now collects the address and continues with the emailed code.
  • An expired login link leads somewhere. Opening a login page whose session has expired — a restored tab, a bookmark — redirects to the tenant's default_redirection_uri when one is configured, as Auth0 does, instead of stopping on an error page. Without one, the error page is unchanged.

Tenant-member invitations send their own email ​

If you let tenants manage their own team through createLocalTenantMembersBackend, an invitation was only emailed when you supplied a sendInvitationEmail function. Pass the request context and the backend sends it for you:

ts
getBackend: (ctx) => createLocalTenantMembersBackend({ ...options, ctx }),

Invitations go out with the built-in invitation template as the control-plane tenant — its email provider, branding, sender address and locales, not the child tenant's — which matches the organization the invitation belongs to. Your own sendInvitationEmail still takes precedence, send_invitation_email: false still sends nothing, and a failed delivery is logged without failing the invitation. The same works on the proxy control-plane path that Workers-for-Platforms shards call, where authenticate is now optional and defaults to the built-in bearer-token check. A backend built without ctx behaves exactly as before.

Also ​

  • Proxy — a deadline now cancels the work behind it: resolveHost takes an optional { signal }, and the router and cache timeouts abort it rather than merely racing the call, so a control-plane lookup stops when its deadline fires. Adapters that ignore the signal keep working. Separately, request bodies up to 128 KiB are forwarded as a buffer instead of a stream, which ends the spurious Can't read from request stream after response has been sent log line when an upstream answers a POST without reading it; a client that stalls while sending a small body gets a 408.
  • Actions — replacing a trigger's bindings is all-or-nothing. A storage failure partway through PATCH /api/v2/actions/triggers/{id}/bindings used to leave the trigger partly or wholly unbound; the previous bindings are now restored and the request fails.
  • Connect — social login during the Connect consent flow works when the session belongs to a client identified by a metadata document; it was being rejected for missing PKCE parameters that the flow never carries.
  • Logs — expected 4xx responses while a /u2 screen loads are no longer logged as errors.

Released ​

PackageSpan
authhero9.13.1 → 9.15.0
@authhero/adapter-interfaces4.15.0
@authhero/drizzle1.7.3 → 1.8.0
@authhero/kysely-adapter12.8.2 → 12.9.0
@authhero/aws-adapter1.3.6 → 1.3.8
@authhero/cloudflare-adapter3.1.4 → 3.1.6
@authhero/proxy0.10.15 → 0.11.1
@authhero/saml0.5.13
@authhero/widget0.39.1
@authhero/admin0.21.0

No package is new this week. The adapter minors are the token-exchange profiles table and migration; the proxy minor is the abort signal on resolveHost.

Dual-licensed: AGPL-3.0-only or commercial license.