mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-04-24 23:05:53 +03:00
[GH-ISSUE #73] OIDC using Authentik leading to 500 error #38
Labels
No labels
bug
documentation
enhancement
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gitea-mirror#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @requ1Re on GitHub (Aug 11, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/73
Originally assigned to: @arunavo4 on GitHub.
Hi, I am trying to configure authentik as my External Identity Provider but I am always met with an error.
I have set it up using the usual values. When I click on "Sign in with [...]" on the "SSO" Tab of the login page, I get redirected to Authentik as expected, but when I confirm the login and get redirected back, I am met with a 500 Internal Server Error. The log shows the following error:
I have tried to set this up multiple times but I didn't manage to do it.
Any help would be appreciated, thank you!
@arunavo4 commented on GitHub (Aug 12, 2025):
@requ1Re please put your docker compose and the urls you have setup along minus the creds.
@requ1Re commented on GitHub (Aug 15, 2025):
Hi, I am not using docker-compose but running the docker image directly using docker run. Other than SSO, everything else is working as expected.
I have set
BETTER_AUTH_URLto the URL of the application. I have also tried with and without a trailing slash.This is the configuration within the application:

@bxm156 commented on GitHub (Aug 19, 2025):
I'm receiving the same error when trying to setup Authenitk. I used the Proxmox VE Script to install gitea-mirror
@hllshiro commented on GitHub (Aug 26, 2025):
I used the docker-compose.yml and .env provided by the repository and encountered the same error.
@arunavo4 commented on GitHub (Aug 28, 2025):
Thanks for reporting this. Will test and fix this issue
@hllshiro commented on GitHub (Sep 3, 2025):
v3.5.0 has an update "Updates to auth url", is that related to this issue? I tested v3.5.1, the issue is still there.
@arunavo4 commented on GitHub (Sep 3, 2025):
Yea it's a partial fix, I will make a proper fix and test it this week and update here. Thank you for testing it.
@arunavo4 commented on GitHub (Oct 22, 2025):
@bxm156 @requ1Re @hllshiro please try the new
v3.8.7the better-auth library that was being used have solved some of the issues that was holding this off. Once you test it and let me know if it works now.@hllshiro commented on GitHub (Oct 23, 2025):
I am currently out of town. I just remotely updated the container and conducted a simple test: it seems the issue still persists, and the error message is the same as before.
The configuration I'm using is consistent with the previous one, which is listed above. Could you please check if there is any error in the configuration? Additionally, I'm using Nginx Proxy Manager for reverse proxy, and the advanced configuration is as shown below:
@arunavo4 commented on GitHub (Oct 23, 2025):
@hllshiro thanks for sharing I will have to try and replicate this. Else I think it will be better if I can do a docker-compose with authentik and then share a guide with it. that way everyone can have a starting point that works.
@arunavo4 commented on GitHub (Oct 26, 2025):
@hllshiro recently this issue #134 poped up and we were able to get it to work with authentik in
v3.8.10after a few updates. Give it a try once and see if it solves your issue.Also, if possible do a fresh install.
@arunavo4 commented on GitHub (Oct 26, 2025):
@bxm156 @requ1Re @hllshiro This has been finally fixed in
v3.8.10but you need to wipe your existing Authentik provider (create a new provider with a freshproviderId) and add it again on v3.8.10 on a fresh install using Discover so the normalized config (with token endpoint) gets stored. confirmed in #122 and #134
@hllshiro commented on GitHub (Oct 29, 2025):
I just updated to v3.8.10 and followed the instructions, removed the old configured oidc and re-added, and now I get another error
@arunavo4 commented on GitHub (Nov 8, 2025):
@hllshiro You are using docker right? Can you try a few common things here
1. Verify Authentik's JWKS Endpoint is Accessible
From inside the gitea-mirror container, test the JWKS endpoint:
Expected response format:
If you get anything else (empty, 404, different format), that's the problem.
2. Authentik Provider Configuration
In Authentik, verify:
Provider type: Use OAuth2/OIDC (not Proxy or SAML)
Flow: Authorization Code flow (not Implicit if possible)
Scopes: At minimum include openid, email, profile
Application type: Web application
3. Authentik JWKS Known Issues
Some Authentik versions have JWKS-related quirks:
Option A - Use Application-Specific Issuer:
Issuer: https://authentik.domain/application/o//
Option B - Use Root Issuer (if Option A fails):
Issuer: https://authentik.domain/application/o//
P.S: Make sure to delete the docker volume and reinstall the whole app once more with correct config and also try and recreate the OIDC /SSO once more just to be sure. Since two people were seperately able to verify it works. I am not sure what else can be wrong with it. But your error message here points to not JSON Web Key Set most likely as thats what is matching when I did a quick search in better auth lib thats being used for OIDC/SSO.
@hllshiro commented on GitHub (Nov 17, 2025):
Sorry for the late reply—I’ve been swamped with moving recently. I’ve run the tests as you suggested, and just as you suspected, the /jwks endpoint returned empty data {}. After checking (I compared it with other providers), I confirmed the issue was a missing signing key. Everything works perfectly now after proper configuration. Thank you so much for your help and detailed guidance!
If you need any additional verification or have further checks to suggest, feel free to let me know—I’m happy to run more tests to ensure stability.
@arunavo4 commented on GitHub (Nov 17, 2025):
Perfect. I think I will take these few OIDC issues and make the docs better. Closing this for now.