[GH-ISSUE #902] Invalid ID Token with Authentik #1684

Closed
opened 2026-04-16 08:25:19 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @txwgnd on GitHub (Jun 13, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/902

Hello Guys,

I'm trying so setup Pangolin with Authentik as the IDP.
When I try to login through Authentik I get presented this error message after Authentiks work is done and I'm redirected to Pangolin:

There was a problem connecting to Authentik. Please contact your administrator.
An error occurred

After looking into the logs of Pangolin the only thing I could find was this:

2025-06-13T00:07:41.087Z [^[[34mdebug^[[39m]: Verify session: Badger sent {"sessions":{},"originalRequestURL":"ht>
2025-06-13T00:07:41.088Z [^[[34mdebug^[[39m]: Request IP: {"requestIp":"94.134.108.202:17795"}
2025-06-13T00:07:41.088Z [^[[34mdebug^[[39m]: Client IP: {"clientIp":"94.134.108.202"}
2025-06-13T00:07:41.088Z [^[[34mdebug^[[39m]: Resource allowed because no auth
2025-06-13T00:07:41.328Z [^[[34mdebug^[[39m]: GET /api/v1/user
2025-06-13T00:07:41.434Z [^[[34mdebug^[[39m]: POST /api/v1/auth/idp/1/oidc/validate-callback
2025-06-13T00:07:41.452Z [^[[34mdebug^[[39m]: Verify session: Badger sent {"sessions":{},"originalRequestURL":"ht>
2025-06-13T00:07:41.453Z [^[[34mdebug^[[39m]: Request IP: {"requestIp":"172.18.0.1:47352"}
2025-06-13T00:07:41.453Z [^[[34mdebug^[[39m]: Client IP: {"clientIp":"172.18.0.1"}
2025-06-13T00:07:41.453Z [^[[34mdebug^[[39m]: Resource allowed because no auth
2025-06-13T00:07:41.863Z [^[[34mdebug^[[39m]: ID token {"idToken":"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2Q0>
2025-06-13T00:07:41.864Z [^[[31merror^[[39m]: Invalid ID token
Stack: Error: Invalid ID token
at Module.decodeIdToken (file:///app/node_modules/arctic/dist/oidc.js:7:15)
at kg (file:///app/dist/server.mjs:31:143353)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-06-13T00:08:51.788Z [^[[32minfo^[[39m]: Handling register message!
2025-06-13T00:08:51.796Z [^[[32minfo^[[39m]: Peer added successfully: {"peer":"Peer added successfully"}

There is no error or problem in the Authentik logs. Unfortunately I couldn't find aynthing about this on the internet. Has anyone an idea what is happening here?

Cheers
Tom

Originally created by @txwgnd on GitHub (Jun 13, 2025). Original GitHub issue: https://github.com/fosrl/pangolin/issues/902 Hello Guys, I'm trying so setup Pangolin with Authentik as the IDP. When I try to login through Authentik I get presented this error message after Authentiks work is done and I'm redirected to Pangolin: > There was a problem connecting to Authentik. Please contact your administrator. An error occurred After looking into the logs of Pangolin the only thing I could find was this: > 2025-06-13T00:07:41.087Z [^[[34mdebug^[[39m]: Verify session: Badger sent {"sessions":{},"originalRequestURL":"ht> 2025-06-13T00:07:41.088Z [^[[34mdebug^[[39m]: Request IP: {"requestIp":"94.134.108.202:17795"} 2025-06-13T00:07:41.088Z [^[[34mdebug^[[39m]: Client IP: {"clientIp":"94.134.108.202"} 2025-06-13T00:07:41.088Z [^[[34mdebug^[[39m]: Resource allowed because no auth 2025-06-13T00:07:41.328Z [^[[34mdebug^[[39m]: GET /api/v1/user 2025-06-13T00:07:41.434Z [^[[34mdebug^[[39m]: POST /api/v1/auth/idp/1/oidc/validate-callback 2025-06-13T00:07:41.452Z [^[[34mdebug^[[39m]: Verify session: Badger sent {"sessions":{},"originalRequestURL":"ht> 2025-06-13T00:07:41.453Z [^[[34mdebug^[[39m]: Request IP: {"requestIp":"172.18.0.1:47352"} 2025-06-13T00:07:41.453Z [^[[34mdebug^[[39m]: Client IP: {"clientIp":"172.18.0.1"} 2025-06-13T00:07:41.453Z [^[[34mdebug^[[39m]: Resource allowed because no auth 2025-06-13T00:07:41.863Z [^[[34mdebug^[[39m]: ID token {"idToken":"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2Q0> 2025-06-13T00:07:41.864Z [^[[31merror^[[39m]: Invalid ID token Stack: Error: Invalid ID token at Module.decodeIdToken (file:///app/node_modules/arctic/dist/oidc.js:7:15) at kg (file:///app/dist/server.mjs:31:143353) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2025-06-13T00:08:51.788Z [^[[32minfo^[[39m]: Handling register message! 2025-06-13T00:08:51.796Z [^[[32minfo^[[39m]: Peer added successfully: {"peer":"Peer added successfully"} There is no error or problem in the Authentik logs. Unfortunately I couldn't find aynthing about this on the internet. Has anyone an idea what is happening here? Cheers Tom
Author
Owner

@orhanveli commented on GitHub (Jun 17, 2025):

Same here, is there anything I should specify explicitly on the Authentik side.

<!-- gh-comment-id:2979978704 --> @orhanveli commented on GitHub (Jun 17, 2025): Same here, is there anything I should specify explicitly on the Authentik side.
Author
Owner

@a-mnich commented on GitHub (Jun 23, 2025):

I've successfully configured Pangolin with authentik.
When creating the provider in authentik I've essentially kept the default settings for the provider, but changed subject mode to based on the users email (but I don't think that this is your problem though) and configured the redirect URI.

Do you maybe have configured an encryption key in authentik? You need to leave this field empty as otherwise pangolin can't decode the token.

Screenshot from the authentik provider:
Image

<!-- gh-comment-id:2995578713 --> @a-mnich commented on GitHub (Jun 23, 2025): I've successfully configured Pangolin with authentik. When creating the provider in authentik I've essentially kept the default settings for the provider, but changed `subject mode` to `based on the users email` (but I don't think that this is your problem though) and configured the redirect URI. Do you maybe have configured an encryption key in authentik? You need to leave this field empty as otherwise pangolin can't decode the token. Screenshot from the authentik provider: ![Image](https://github.com/user-attachments/assets/003a298b-a998-4e28-a690-cc5f89cb88bd)
Author
Owner

@BeeTwenty commented on GitHub (Jun 26, 2025):

i redid it exacly like you said

does not work

2025-06-26T12:13:31.938Z [error]: Unexpected error response
Stack: Error: Unexpected error response
at sendTokenRequest (file:///app/node_modules/arctic/dist/request.js:74:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async OAuth2Client.validateAuthorizationCode (file:///app/node_modules/arctic/dist/client.js:66:24)
at async kg (file:///app/dist/server.mjs:31:143232) {"status":403}

<!-- gh-comment-id:3008279549 --> @BeeTwenty commented on GitHub (Jun 26, 2025): i redid it exacly like you said does not work 2025-06-26T12:13:31.938Z [error]: Unexpected error response Stack: Error: Unexpected error response at sendTokenRequest (file:///app/node_modules/arctic/dist/request.js:74:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async OAuth2Client.validateAuthorizationCode (file:///app/node_modules/arctic/dist/client.js:66:24) at async kg (file:///app/dist/server.mjs:31:143232) {"status":403}
Author
Owner

@ThanatosDi commented on GitHub (Jun 26, 2025):

I also have Invalid ID Token error

follow @a-mnich remove authentik Encryption Key it working

Image

I've successfully configured Pangolin with authentik. When creating the provider in authentik I've essentially kept the default settings for the provider, but changed subject mode to based on the users email (but I don't think that this is your problem though) and configured the redirect URI.

Do you maybe have configured an encryption key in authentik? You need to leave this field empty as otherwise pangolin can't decode the token.

Screenshot from the authentik provider: Image

<!-- gh-comment-id:3009252983 --> @ThanatosDi commented on GitHub (Jun 26, 2025): I also have `Invalid ID Token` error follow @a-mnich remove authentik `Encryption Key` it working ![Image](https://github.com/user-attachments/assets/7ded3342-dc5d-4fb1-a348-9edb6f42469e) > I've successfully configured Pangolin with authentik. When creating the provider in authentik I've essentially kept the default settings for the provider, but changed `subject mode` to `based on the users email` (but I don't think that this is your problem though) and configured the redirect URI. > > Do you maybe have configured an encryption key in authentik? You need to leave this field empty as otherwise pangolin can't decode the token. > > Screenshot from the authentik provider: ![Image](https://github.com/user-attachments/assets/003a298b-a998-4e28-a690-cc5f89cb88bd)
Author
Owner

@BeeTwenty commented on GitHub (Jun 26, 2025):

I also have Invalid ID Token error

follow @a-mnich remove authentik Encryption Key it working

Image

I've successfully configured Pangolin with authentik. When creating the provider in authentik I've essentially kept the default settings for the provider, but changed subject mode to based on the users email (but I don't think that this is your problem though) and configured the redirect URI.
Do you maybe have configured an encryption key in authentik? You need to leave this field empty as otherwise pangolin can't decode the token.
Screenshot from the authentik provider: Image

That actually dont fix it for me

<!-- gh-comment-id:3009742712 --> @BeeTwenty commented on GitHub (Jun 26, 2025): > I also have `Invalid ID Token` error > > follow [@a-mnich](https://github.com/a-mnich) remove authentik `Encryption Key` it working > > ![Image](https://github.com/user-attachments/assets/7ded3342-dc5d-4fb1-a348-9edb6f42469e) > > > I've successfully configured Pangolin with authentik. When creating the provider in authentik I've essentially kept the default settings for the provider, but changed `subject mode` to `based on the users email` (but I don't think that this is your problem though) and configured the redirect URI. > > Do you maybe have configured an encryption key in authentik? You need to leave this field empty as otherwise pangolin can't decode the token. > > Screenshot from the authentik provider: ![Image](https://github.com/user-attachments/assets/003a298b-a998-4e28-a690-cc5f89cb88bd) That actually dont fix it for me
Author
Owner

@txwgnd commented on GitHub (Jun 30, 2025):

Hello All,

Thanks for Your answers!
One of my problems was actually that I've set to use an encryption key. I also used a testing container for testing OIDC in general and I had a lot of false negative problems with it leading to a lot of confusion.

Cheers
Tom

<!-- gh-comment-id:3018964065 --> @txwgnd commented on GitHub (Jun 30, 2025): Hello All, Thanks for Your answers! One of my problems was actually that I've set to use an encryption key. I also used a testing container for testing OIDC in general and I had a lot of false negative problems with it leading to a lot of confusion. Cheers Tom
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#1684