OIDC login fails with Authentik – callback request uses localhost inside container and token exchange returns unexpected response #3027
Replies: 4 comments
|
I use authelia and don't have the issue, can you provide what you configured in pangolin omitting any secrets but still populating so we know what it looks like? |
|
Just figured this out: Option 1 to make it workThe issue is caused by Pangolin trying to reach Authentik through the Pangolin-proxied public URL instead of directly via the internal network. I originally configured the OIDC endpoints like this:
Since Authentik itself was behind Pangolin, the token exchange returned an unexpected response and Pangolin logged:
The fix was to configure Pangolin to use the internal Authentik address instead of the public proxied URL, for example:
After switching to the direct internal endpoint, OIDC login worked correctly. Option 2 to make it workI also found another working solution. The issue only occurred because the Authentik instance itself was protected by Pangolin access control. In that setup, Pangolin tried to perform the OIDC token exchange against an endpoint that was again gated by Pangolin authentication, which resulted in the unexpected response error. If I disable access control for the Authentik application in Pangolin, the public proxied URL works correctly as the OIDC endpoint, for example: https://auth.example.com/application/o/authorize/ So there are two possible fixes:
I am not very happy with this. Do you have any idea on how to work with my pangolin-protected url for authentic? I tried with a rule to skip auth from my country, my ip, ..... No luck. |
|
for anyone else wandering in here, i had similiar struggles and figured my solution might help someone else: networks:
default:
aliases:
- <auth_domain>Sidenote: it might work without the port in the token URL if you bind gerbil/traefik to the standard-ports, why i had to add the port: |




Uh oh!
There was an error while loading. Please reload this page.
Description:
I am running Pangolin and Authentik on the same VPS, each in its own Docker Compose setup. Authentik is already successfully used as an Identity Provider for other services, so the OIDC setup itself is working in general.
However, when configuring Authentik as an IDP in Pangolin, the login flow does not complete successfully.
Steps to reproduce:
Expected behavior:
OIDC login should complete successfully and redirect back to Pangolin with a valid token.
Actual behavior:
Login fails during token exchange / callback validation.
Pangolin logs show:
Observations:
http://localhost:3000localhostlikely refers to the container itself rather than the host or reverse proxyPossible causes / suspicions:
localhostinside the container instead of service name / network aliasEnvironment:
Question:
Is it expected that Pangolin uses
localhost:3000internally for OIDC callback validation?If yes, how should this work correctly in a Dockerized multi-stack setup?
Or is this an indication of a misconfiguration / bug in how internal API URLs are generated?
All reactions