<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Self-service &#x2F;account&#x2F;login returns 401 &quot;Access denied&quot; after a successful code exchange (production only, 1.71.0)]]></title><description><![CDATA[<p dir="auto">Summary<br />
On our production instance, the hosted self-service account pages deny every user. After login, the final<br />
redirect to /account/login returns 401 "Access denied" and clears the account-session cookies. The OAuth<br />
debug log shows that the authorization code exchange inside that flow succeeds, so the denial happens after<br />
it. The same configuration works on our other FusionAuth instances. We'd like to know which check after the<br />
exchange produces this 401, and how to see its reason.</p>
<p dir="auto">Environment</p>
<ul>
<li>FusionAuth 1.71.0, self-hosted, Docker image fusionauth/fusionauth-app:1.71.0 on Kubernetes. Starter licence.</li>
<li>Installed in silent mode with Kickstart; configuration then applied through the API.</li>
<li>FUSIONAUTH_APP_RUNTIME_MODE=production, SEARCH_TYPE=database, managed PostgreSQL.</li>
<li>Two FusionAuth nodes, one in each of two Kubernetes clusters, sharing the same database. The clusters<br />
cannot reach each other, and fusionauth-app.url is <a href="http://localhost:9011" rel="nofollow ugc">http://localhost:9011</a> on both nodes.</li>
<li>Request path: a cloud load balancer, then an internal router, then an Apache reverse proxy that sets X-Forwarded-Proto:<br />
https, X-Forwarded-Host: <a href="http://auth.example.edu" rel="nofollow ugc">auth.example.edu</a> and X-Forwarded-Port: 443, then FusionAuth.<br />
trustedProxyConfiguration is OnlyConfigured and lists the proxy CIDRs. FusionAuth logs the real client IP,<br />
so the forwarded headers are being honoured.</li>
<li>One tenant. Self-service form set on the application: a custom form containing only the password field.<br />
requireCurrentPasswordOnPasswordChange is on.</li>
</ul>
<p dir="auto">Reproduction (deterministic)</p>
<ol>
<li>Fresh private browser window: <a href="https://auth.example.edu/account/?client_id=" rel="nofollow ugc">https://auth.example.edu/account/?client_id=</a>&lt;client_id&gt;</li>
<li>302 to /account/login?client_id&amp;tenantId, then 302 to /oauth2/authorize (PKCE S256,<br />
redirect_uri=/account/login, scope offline_access).</li>
<li>Log in. It fails the same way with a local password user and with users from our SAML v2 identity provider.</li>
<li>/oauth2/consent 302 to /account/login?client_id&amp;tenantId&amp;code&amp;iss&amp;locale&amp;state&amp;userState=Authenticated</li>
<li>That request returns 401 "Access denied". The response sets <a href="http://fusionauth.at" rel="nofollow ugc">fusionauth.at</a>, fusionauth.rt, fusionauth.csrf<br />
and fusionauth.app.pkce-verifier to empty with Max-Age=0. The request carried prime-mvc-saved-request,<br />
fusionauth.csrf, fusionauth.app.pkce-verifier and fusionauth.sso, all set earlier in the same flow.</li>
</ol>
<p dir="auto">Evidence that the code exchange succeeds<br />
With oauthConfiguration.debug enabled on the application, the event log records this for the flow<br />
(Scopes requested [offline_access]):<br />
Validate the provided authorization code ...<br />
Validate PKCE code_challenge ... Calculated code_challenge [matches]<br />
Ensure the provided request parameters match those provided the authorization request.<br />
User is registered for application with Id [&lt;client_id&gt;] the [roles] and [applicationId] claims will be added.<br />
The authorization code has been successfully exchanged for an access token.</p>
<p dir="auto">What we have ruled out</p>
<ul>
<li>User or registration data: the test user is active and verified, and registered to the application with a<br />
role. A newly created local password user fails the same way.</li>
<li>Signing keys: a token from the Login API for the same user and application validates with<br />
GET /api/jwt/validate (200), and its RS256 signature verifies against /api/jwt/public-key for its kid.<br />
iss is <a href="https://auth.example.edu" rel="nofollow ugc">https://auth.example.edu</a> and aud is the client id.</li>
<li>Load balancing across nodes: in one captured failing attempt, every request in the flow went to the same<br />
node, including the 401.</li>
<li>IP reputation: users on several different networks are all denied.</li>
<li>Configuration: we diffed applications, tenant, keys, identity providers, forms, form fields, lambdas,<br />
themes, email templates, webhooks and system configuration against a working instance. Apart from debug<br />
flags, email settings, the IdP endpoint and the webhook URL, the only difference is trustedProxyConfiguration<br />
(OnlyConfigured here, All on the working instances). Adding 127.0.0.1/32 and ::1/128 to the trusted list<br />
did not help.</li>
</ul>
<p dir="auto">Where it works<br />
The same version and configuration, installed the same way (Kickstart plus the same API configuration), work<br />
on two other instances. Each is a single node, one licensed and one unlicensed, with trustPolicy All.</p>
<p dir="auto">Questions</p>
<ol>
<li>After the code exchange, what does the /account/login handler check that can return 401 "Access denied"<br />
and clear the account cookies?</li>
<li>Does that check depend on the node's fusionauth-app.url (<a href="http://localhost:9011" rel="nofollow ugc">http://localhost:9011</a>), on the forwarded host or<br />
scheme, or on communication between nodes (ours cannot reach each other)?</li>
<li>Is there a logger we can raise to debug, or a setting, that would show the reason for this 401?</li>
</ol>
<p dir="auto">Happy to run any diagnostics suggested here and post the results.</p>
]]></description><link>https://fusionauth.io/community/forum/topic/3436/self-service-account-login-returns-401-access-denied-after-a-successful-code-exchange-production-only-1-71-0</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 01:18:44 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/3436.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Nov 2026 02:24:35 GMT</pubDate><ttl>60</ttl></channel></rss>