[GH-ISSUE #2266] OAuth Re-Direct Using Wrong Port #1386

Open
opened 2026-03-02 11:56:56 +03:00 by kerem · 4 comments
Owner

Originally created by @nekromantik on GitHub (Dec 17, 2025).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/2266

Describe the Bug

So I setup Karakeep with OAuth setup via Authentik. I can access my Karakeep login page but when I press Login Authentik it does redirect to Auth URL but is missing the port number. Even though its included in the settings as shown below:

NEXTAUTH_URL=https://karakeep.company:8443 OAUTH_CLIENT_ID=<Client ID from authentik> OAUTH_CLIENT_SECRET=<Client secret from authentik> OAUTH_WELLKNOWN_URL=https://authentik.company:8443/application/o/karakeep/.well-known/openid-configuration OAUTH_PROVIDER_NAME=authentik

Any way to force Karakeep to not default to port 443 for re-direct?

Steps to Reproduce

Set-up OAuth on Karakeep
Access Karakeep on non default port
Press oAuth Login

Expected Behaviour

Redirects to Authentik with correct port

Screenshots or Additional Context

No response

Device Details

Docker Container on UnRaid

Exact Karakeep Version

0.29.3

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem
Originally created by @nekromantik on GitHub (Dec 17, 2025). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/2266 ### Describe the Bug So I setup Karakeep with OAuth setup via Authentik. I can access my Karakeep login page but when I press Login Authentik it does redirect to Auth URL but is missing the port number. Even though its included in the settings as shown below: `NEXTAUTH_URL=https://karakeep.company:8443 OAUTH_CLIENT_ID=<Client ID from authentik> OAUTH_CLIENT_SECRET=<Client secret from authentik> OAUTH_WELLKNOWN_URL=https://authentik.company:8443/application/o/karakeep/.well-known/openid-configuration OAUTH_PROVIDER_NAME=authentik` Any way to force Karakeep to not default to port 443 for re-direct? ### Steps to Reproduce Set-up OAuth on Karakeep Access Karakeep on non default port Press oAuth Login ### Expected Behaviour Redirects to Authentik with correct port ### Screenshots or Additional Context _No response_ ### Device Details Docker Container on UnRaid ### Exact Karakeep Version 0.29.3 ### Have you checked the troubleshooting guide? - [x] I have checked the troubleshooting guide and I haven't found a solution to my problem
Author
Owner

@MohamedBassem commented on GitHub (Dec 18, 2025):

@nekromantik I'm a bit confused, is the problem is that we're redirecting to authentik with the incorrect port, or that we're redirecting "back" from authentik to karakeep on the wrong port?

<!-- gh-comment-id:3668447798 --> @MohamedBassem commented on GitHub (Dec 18, 2025): @nekromantik I'm a bit confused, is the problem is that we're redirecting to authentik with the incorrect port, or that we're redirecting "back" from authentik to karakeep on the wrong port?
Author
Owner

@nekromantik commented on GitHub (Dec 18, 2025):

@nekromantik I'm a bit confused, is the problem is that we're redirecting to authentik with the incorrect port, or that we're redirecting "back" from authentik to karakeep on the wrong port?

Hello

It's redirecting to Authentik from Karakeep login page on wrong port.

<!-- gh-comment-id:3669499453 --> @nekromantik commented on GitHub (Dec 18, 2025): > [@nekromantik](https://github.com/nekromantik) I'm a bit confused, is the problem is that we're redirecting to authentik with the incorrect port, or that we're redirecting "back" from authentik to karakeep on the wrong port? Hello It's redirecting to Authentik from Karakeep login page on wrong port.
Author
Owner

@MohamedBassem commented on GitHub (Dec 20, 2025):

If you're saying that karakeep is redirecting to authentik on the wrong port then authentik itself is misconfigured. Karakeep finds the address of authentik by calling the well known address you provided to karakeep. If you go to the browser to

https://authentik.company:8443/application/o/karakeep/.well-known/openid-configuration

you should see that address that authentik itself is advertising to karakeep. If the links there don't have the port, then authentik itself is not aware of its own port.

<!-- gh-comment-id:3677666965 --> @MohamedBassem commented on GitHub (Dec 20, 2025): If you're saying that karakeep is redirecting to authentik on the wrong port then authentik itself is misconfigured. Karakeep finds the address of authentik by calling the well known address you provided to karakeep. If you go to the browser to ``` https://authentik.company:8443/application/o/karakeep/.well-known/openid-configuration ``` you should see that address that authentik itself is advertising to karakeep. If the links there don't have the port, then authentik itself is not aware of its own port.
Author
Owner

@nekromantik commented on GitHub (Dec 21, 2025):

If you're saying that karakeep is redirecting to authentik on the wrong port then authentik itself is misconfigured. Karakeep finds the address of authentik by calling the well known address you provided to karakeep. If you go to the browser to

https://authentik.company:8443/application/o/karakeep/.well-known/openid-configuration

you should see that address that authentik itself is advertising to karakeep. If the links there don't have the port, then authentik itself is not aware of its own port.

As you can ses it has 8443 in the well known address as I posted in op
It’s ignoring and using 443 hence I raised this ticket
I am also using 8443 to get to authentik login admin page just fine without karakeep

<!-- gh-comment-id:3678750484 --> @nekromantik commented on GitHub (Dec 21, 2025): > If you're saying that karakeep is redirecting to authentik on the wrong port then authentik itself is misconfigured. Karakeep finds the address of authentik by calling the well known address you provided to karakeep. If you go to the browser to > > ``` > https://authentik.company:8443/application/o/karakeep/.well-known/openid-configuration > ``` > > you should see that address that authentik itself is advertising to karakeep. If the links there don't have the port, then authentik itself is not aware of its own port. As you can ses it has 8443 in the well known address as I posted in op It’s ignoring and using 443 hence I raised this ticket I am also using 8443 to get to authentik login admin page just fine without karakeep
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#1386
No description provided.