After doing so and saving it all seemed fine, but after clicking logout, it showed an message at the bottom right that there is a JSON error but not the actual error, then it was like the gitea-mirror UI, but not with any data, and I didn't get redirected to loginpage.
After that the application responded with Code 500 Internal Server Error and this log:
Oct 22 08:06:14 gitea-mirror bun[13473]: [Scheduler] Processing 1 valid configurations (out of 1 with scheduling enabled)
Oct 22 08:06:14 gitea-mirror bun[13473]: [Scheduler] Skipping user cgINKObx5R3XUQpzDS7JpVIZvnnGPvKy - next run at 2025-10-23T05:55:14.645Z
EDIT: I could not find any other relevant error in the log, accoring to the log everything should work fine.
I couldn't even get to a login page and a state where I could sign in with authentik, so this problem is purely on gitea-mirror side.
Also I saw you are using IDs for user, is it possible to map an existing user to an OIDC user?
can I just change the user ID via the DB, or do you plan on adding this feature?
Originally created by @CrazyWolf13 on GitHub (Oct 22, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/122
Originally assigned to: @arunavo4 on GitHub.
Hi @arunavo4
I set up SSO via authentik today.
After doing so and saving it all seemed fine, but after clicking logout, it showed an message at the bottom right that there is a JSON error but not the actual error, then it was like the gitea-mirror UI, but not with any data, and I didn't get redirected to loginpage.
After that the application responded with Code 500 Internal Server Error and this log:
```bash
Oct 22 08:06:14 gitea-mirror bun[13473]: [Scheduler] Processing 1 valid configurations (out of 1 with scheduling enabled)
Oct 22 08:06:14 gitea-mirror bun[13473]: [Scheduler] Skipping user cgINKObx5R3XUQpzDS7JpVIZvnnGPvKy - next run at 2025-10-23T05:55:14.645Z
```
EDIT: I could not find any other relevant error in the log, accoring to the log everything should work fine.
I couldn't even get to a login page and a state where I could sign in with authentik, so this problem is purely on gitea-mirror side.
Also I saw you are using IDs for user, is it possible to map an existing user to an OIDC user?
can I just change the user ID via the DB, or do you plan on adding this feature?
my bad, still had reverse_proxy auth enabled on my reverse proxy.
500 Error is gone, but I'm getting this:
<!-- gh-comment-id:3430658325 -->
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
my bad, still had reverse_proxy auth enabled on my reverse proxy.
500 Error is gone, but I'm getting this:
<img width="1238" height="582" alt="Image" src="https://github.com/user-attachments/assets/e63e0569-d0e2-4a44-9e8d-20280825c2b9" />
If I shall test the PR, I'd be happy to do so, but then a tagged release would be awesome, so I can test it :)
<!-- gh-comment-id:3430667896 -->
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
@arunavo4 main branch.
If I shall test the PR, I'd be happy to do so, but then a tagged release would be awesome, so I can test it :)
<!-- gh-comment-id:3430676161 -->
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 this should work https://github.com/RayLabsHQ/gitea-mirror/releases/tag/v3-sso since you need source files right?
@CrazyWolf13 also was there anything from docker logs>? on main branch anything useful?
<!-- gh-comment-id:3430695786 -->
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 also was there anything from docker logs>? on main branch anything useful?
@arunavo4 I'm not using docker, I'm the proxmox guy :D
Yes, with the new branch deployed I can see this:
Oct 22 08:41:27 gitea-mirror bun[13994]: # SERVER_ERROR: 467 | let { baseURL, params, query } = option || {
Oct 22 08:41:27 gitea-mirror bun[13994]: 468| query: {},
Oct 22 08:41:27 gitea-mirror bun[13994]: 469| params: {},
Oct 22 08:41:27 gitea-mirror bun[13994]: 470| baseURL: ""
Oct 22 08:41:27 gitea-mirror bun[13994]: 471|};
Oct 22 08:41:27 gitea-mirror bun[13994]: 472|letbasePath= url.startsWith("http") ? url.split("/").slice(0, 3).join("/") : baseURL ||"";
Oct 22 08:41:27 gitea-mirror bun[13994]: ^
Oct 22 08:41:27 gitea-mirror bun[13994]: TypeError: undefined is not an object (evaluating 'url.startsWith')
Oct 22 08:41:27 gitea-mirror bun[13994]: at getURL2 (/opt/gitea-mirror/node_modules/@better-fetch/fetch/dist/index.js:472:18)
Oct 22 08:41:27 gitea-mirror bun[13994]: at <anonymous> (/opt/gitea-mirror/node_modules/@better-fetch/fetch/dist/index.js:521:16)
did you setup your env vars properly?
<!-- gh-comment-id:3430717936 -->
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
@arunavo4 I'm not using docker, I'm the proxmox guy :D
Yes, with the new branch deployed I can see this:
```bash
Oct 22 08:41:27 gitea-mirror bun[13994]: # SERVER_ERROR: 467 | let { baseURL, params, query } = option || {
Oct 22 08:41:27 gitea-mirror bun[13994]: 468 | query: {},
Oct 22 08:41:27 gitea-mirror bun[13994]: 469 | params: {},
Oct 22 08:41:27 gitea-mirror bun[13994]: 470 | baseURL: ""
Oct 22 08:41:27 gitea-mirror bun[13994]: 471 | };
Oct 22 08:41:27 gitea-mirror bun[13994]: 472 | let basePath = url.startsWith("http") ? url.split("/").slice(0, 3).join("/") : baseURL || "";
Oct 22 08:41:27 gitea-mirror bun[13994]: ^
Oct 22 08:41:27 gitea-mirror bun[13994]: TypeError: undefined is not an object (evaluating 'url.startsWith')
Oct 22 08:41:27 gitea-mirror bun[13994]: at getURL2 (/opt/gitea-mirror/node_modules/@better-fetch/fetch/dist/index.js:472:18)
Oct 22 08:41:27 gitea-mirror bun[13994]: at <anonymous> (/opt/gitea-mirror/node_modules/@better-fetch/fetch/dist/index.js:521:16)
```
did you setup your env vars properly?
@CrazyWolf13 can you try the v3.8.7 version look like better-auth have fixed some of the issues with sso that was blocking in their new beta release.
<!-- gh-comment-id:3432298967 -->
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 can you try the `v3.8.7` version look like better-auth have fixed some of the issues with sso that was blocking in their new beta release.
@CrazyWolf13 can you share a screenshot of your OIDC config, you can redact domain. also is your authentik in http or https ?
<!-- gh-comment-id:3447981373 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 can you share a screenshot of your OIDC config, you can redact domain. also is your authentik in `http` or `https` ?
Weird in #134 @ngregrichardson seems to have worked it out, might be the way authetik is configured. Hoping he can provide some help regarding how he is using authentik setup.
<!-- gh-comment-id:3448305316 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
Weird in #134 @ngregrichardson seems to have worked it out, might be the way authetik is configured. Hoping he can provide some help regarding how he is using authentik setup.
@CrazyWolf13 and is gitea mirror also running behind the proxy? with https?
<!-- gh-comment-id:3448308487 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 and is gitea mirror also running behind the proxy? with https?
Tbh. authentik doesn't really have a config, you tell it just you want a new OIDC Provider with app and select implicit or explicit, that's it.
My Reverse Proxy is on defaults, so that should work.
This is the code I get on SSO:
GET
https://gitea-mirror.mydomain_redacted.dev/api/auth/sso/callback/authentik?code=1070b9247d7f4496819abc217728293c&state=JrxduiWLE6sXwkfPmXXB3z_rBazd0wY7
NS_ERROR_NET_ERROR_RESPONSE
GET
https://gitea-mirror.mydomain_redacted.dev/api/auth/sso/callback/authentik?code=1070b9247d7f4496819abc217728293c&state=JrxduiWLE6sXwkfPmXXB3z_rBazd0wY7
Status
500
VersionHTTP/2
Übertragen182 B (0 B Größe)
Referrer Policysame-origin
Anfrage-PrioritätHighest
DNS-AuflösungSystem
content-length
0
date
Sun, 26 Oct 2025 10:10:22 GMT
server
openresty
strict-transport-security
max-age=63072000;includeSubDomains; preload
X-Firefox-Spdy
h2
Accept
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding
gzip, deflate, br, zstd
Accept-Language
de,en-US;q=0.7,en;q=0.3
Connection
keep-alive
Cookie
__Secure-better-auth.state=JrxduiWLE6sXwkfPmXXB3z_rBazd0wY7.MydOxC4vW1pm%2FdBCPf8SbTj0thfWKwDhgfEUp3L%2Br6U%3D
DNT
1
Host
gitea-mirror.mydomain_redacted.dev
Priority
u=0, i
Referer
https://gitea-mirror.mydomain_redacted.dev/
Sec-Fetch-Dest
document
Sec-Fetch-Mode
navigate
Sec-Fetch-Site
same-site
Sec-Fetch-User
?1
Sec-GPC
1
Upgrade-Insecure-Requests
1
User-Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
Mine is also not an issuer mismatch, a different issue:
<!-- gh-comment-id:3448341697 -->
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 yes.
Tbh. authentik doesn't really have a config, you tell it just you want a new OIDC Provider with app and select implicit or explicit, that's it.
My Reverse Proxy is on defaults, so that should work.
This is the code I get on SSO:
```bash
GET
https://gitea-mirror.mydomain_redacted.dev/api/auth/sso/callback/authentik?code=1070b9247d7f4496819abc217728293c&state=JrxduiWLE6sXwkfPmXXB3z_rBazd0wY7
NS_ERROR_NET_ERROR_RESPONSE
GET
https://gitea-mirror.mydomain_redacted.dev/api/auth/sso/callback/authentik?code=1070b9247d7f4496819abc217728293c&state=JrxduiWLE6sXwkfPmXXB3z_rBazd0wY7
Status
500
VersionHTTP/2
Übertragen182 B (0 B Größe)
Referrer Policysame-origin
Anfrage-PrioritätHighest
DNS-AuflösungSystem
content-length
0
date
Sun, 26 Oct 2025 10:10:22 GMT
server
openresty
strict-transport-security
max-age=63072000;includeSubDomains; preload
X-Firefox-Spdy
h2
Accept
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding
gzip, deflate, br, zstd
Accept-Language
de,en-US;q=0.7,en;q=0.3
Connection
keep-alive
Cookie
__Secure-better-auth.state=JrxduiWLE6sXwkfPmXXB3z_rBazd0wY7.MydOxC4vW1pm%2FdBCPf8SbTj0thfWKwDhgfEUp3L%2Br6U%3D
DNT
1
Host
gitea-mirror.mydomain_redacted.dev
Priority
u=0, i
Referer
https://gitea-mirror.mydomain_redacted.dev/
Sec-Fetch-Dest
document
Sec-Fetch-Mode
navigate
Sec-Fetch-Site
same-site
Sec-Fetch-User
?1
Sec-GPC
1
Upgrade-Insecure-Requests
1
User-Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
```
Mine is also not an issuer mismatch, a different issue:
<img width="927" height="438" alt="Image" src="https://github.com/user-attachments/assets/cb3f66bf-2cd7-484a-9b1e-eb1d84876bd8" />
@ngregrichardson commented on GitHub (Oct 26, 2025):
My setup wasn't noticeably different than any other authentik OIDC setup --
Create a new Application with Provider
Enter name
Select OIDC type
Select the implicit flow
Start the Gitea mirror SSO process
Enter "authentik" as Provider ID
Copy redirect URL from Gitea mirror
Add redirect url to authentik provider
Create the provider
Copy issuer URL, client id, and client secret from authentik
Paste into Gitea mirror
Click Discover
Voila?
I started this with latest build, then @arunavo4 made some changes to fix some issues regarding trailing slashes, etc. so as of now I'm not on the latest tag. I'm running this on Unraid v7.1.4 so I don't have much help in terms of proxmox unfortunately.
<!-- gh-comment-id:3448485784 -->
@ngregrichardson commented on GitHub (Oct 26, 2025):
My setup wasn't noticeably different than any other authentik OIDC setup --
1. Create a new Application with Provider
2. Enter name
3. Select OIDC type
4. Select the implicit flow
5. Start the Gitea mirror SSO process
6. Enter "authentik" as Provider ID
7. Copy redirect URL from Gitea mirror
8. Add redirect url to authentik provider
9. Create the provider
10. Copy issuer URL, client id, and client secret from authentik
11. Paste into Gitea mirror
12. Click Discover
13. Voila?
I started this with latest build, then @arunavo4 made some changes to fix some issues regarding trailing slashes, etc. so as of now I'm not on the latest tag. I'm running this on Unraid v7.1.4 so I don't have much help in terms of proxmox unfortunately.
@ngregrichardson Thanks for the steps, yeah I've done it the same way like you and what I've done countless times already in my Homelab.
the SSO flow per se works fine, as I click on login on the gitea-mirror UI, get redirected to authentik, it creates the redirect or I have to login, then back on gitea-mirror there is this Internal Server Error 500.
As my reverse Proxy (nginxproxymanager) is left on all defaults e.g. no custom config, I think this is an issue of gitea-mirror.
<!-- gh-comment-id:3448499473 -->
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@ngregrichardson Thanks for the steps, yeah I've done it the same way like you and what I've done countless times already in my Homelab.
the SSO flow per se works fine, as I click on login on the gitea-mirror UI, get redirected to authentik, it creates the redirect or I have to login, then back on gitea-mirror there is this Internal Server Error 500.
As my reverse Proxy (nginxproxymanager) is left on all defaults e.g. no custom config, I think this is an issue of gitea-mirror.
@arunavo4 were you able to replicate the issue or did it work fine for you with authentik?
<!-- gh-comment-id:3448500016 -->
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 were you able to replicate the issue or did it work fine for you with authentik?
Not yet, But will try and set it up on docker compose and see if I can get it to work.
<!-- gh-comment-id:3448501903 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
Not yet, But will try and set it up on docker compose and see if I can get it to work.
@CrazyWolf13 please try v3.8.10 as in this issue #134 we were able to get it to work with authentik.
<!-- gh-comment-id:3448554382 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 please try `v3.8.10` as in this issue #134 we were able to get it to work with authentik.
@CrazyWolf13 so you are accessing it from https://gitea-mirror.redacted.dev right? or from http://10.10.20.45:4321?
<!-- gh-comment-id:3448569644 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 so you are accessing it from `https://gitea-mirror.redacted.dev` right? or from `http://10.10.20.45:4321`?
@arunavo4 via domain, locally through the IP is only in spcacial circumstances to fix /debug things, but there I don't mind SSO not working.
<!-- gh-comment-id:3448571736 -->
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 via domain, locally through the IP is only in spcacial circumstances to fix /debug things, but there I don't mind SSO not working.
@CrazyWolf13 can you wipe your existing Authentik provider (create a new provider with a fresh
providerId) and add it again on v3.8.10 on a fresh install using Discover so the normalized config (with token endpoint) gets stored.
<!-- gh-comment-id:3448574419 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 can you wipe your existing Authentik provider (create a new provider with a fresh
providerId) and add it again on `v3.8.10` on a fresh install using Discover so the normalized config (with token endpoint) gets stored.
@arunavo4 wow, that actually fixed it, recreating the provider in gitea-mirror only was sufficient.
Thanks a lot!
<!-- gh-comment-id:3448577266 -->
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 wow, that actually fixed it, recreating the provider in gitea-mirror only was sufficient.
Thanks a lot!
@CrazyWolf13 awesome I will update some of the methods so that this will be a warning for users using older versions. and will link all these issues in readme if people get these issues.
<!-- gh-comment-id:3448578524 -->
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 awesome I will update some of the methods so that this will be a warning for users using older versions. and will link all these issues in readme if people get these issues.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @CrazyWolf13 on GitHub (Oct 22, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/122
Originally assigned to: @arunavo4 on GitHub.
Hi @arunavo4
I set up SSO via authentik today.
After doing so and saving it all seemed fine, but after clicking logout, it showed an message at the bottom right that there is a JSON error but not the actual error, then it was like the gitea-mirror UI, but not with any data, and I didn't get redirected to loginpage.
After that the application responded with Code 500 Internal Server Error and this log:
EDIT: I could not find any other relevant error in the log, accoring to the log everything should work fine.
I couldn't even get to a login page and a state where I could sign in with authentik, so this problem is purely on gitea-mirror side.
Also I saw you are using IDs for user, is it possible to map an existing user to an OIDC user?
can I just change the user ID via the DB, or do you plan on adding this feature?
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 did you try this PR #96
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
my bad, still had reverse_proxy auth enabled on my reverse proxy.
500 Error is gone, but I'm getting this:
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 is this on the main branch or the PR #96
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
@arunavo4 main branch.
If I shall test the PR, I'd be happy to do so, but then a tagged release would be awesome, so I can test it :)
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 let me make one for you
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 this should work https://github.com/RayLabsHQ/gitea-mirror/releases/tag/v3-sso since you need source files right?
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 also was there anything from docker logs>? on main branch anything useful?
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
@arunavo4 I'm not using docker, I'm the proxmox guy :D
Yes, with the new branch deployed I can see this:
did you setup your env vars properly?
@CrazyWolf13 commented on GitHub (Oct 22, 2025):
@arunavo4
Yes I think so, otherwise let me know.
@arunavo4 commented on GitHub (Oct 22, 2025):
@CrazyWolf13 can you try the
v3.8.7version look like better-auth have fixed some of the issues with sso that was blocking in their new beta release.@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 can you share a screenshot of your OIDC config, you can redact domain. also is your authentik in
httporhttps?@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 authentik is https via nginxreverseproxymanager.
sure:
@arunavo4 commented on GitHub (Oct 26, 2025):
Weird in #134 @ngregrichardson seems to have worked it out, might be the way authetik is configured. Hoping he can provide some help regarding how he is using authentik setup.
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 and is gitea mirror also running behind the proxy? with https?
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 yes.
Tbh. authentik doesn't really have a config, you tell it just you want a new OIDC Provider with app and select implicit or explicit, that's it.
My Reverse Proxy is on defaults, so that should work.
This is the code I get on SSO:
Mine is also not an issuer mismatch, a different issue:
@ngregrichardson commented on GitHub (Oct 26, 2025):
My setup wasn't noticeably different than any other authentik OIDC setup --
I started this with latest build, then @arunavo4 made some changes to fix some issues regarding trailing slashes, etc. so as of now I'm not on the latest tag. I'm running this on Unraid v7.1.4 so I don't have much help in terms of proxmox unfortunately.
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@ngregrichardson Thanks for the steps, yeah I've done it the same way like you and what I've done countless times already in my Homelab.
the SSO flow per se works fine, as I click on login on the gitea-mirror UI, get redirected to authentik, it creates the redirect or I have to login, then back on gitea-mirror there is this Internal Server Error 500.
As my reverse Proxy (nginxproxymanager) is left on all defaults e.g. no custom config, I think this is an issue of gitea-mirror.
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 were you able to replicate the issue or did it work fine for you with authentik?
@arunavo4 commented on GitHub (Oct 26, 2025):
Not yet, But will try and set it up on docker compose and see if I can get it to work.
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 please try
v3.8.10as in this issue #134 we were able to get it to work with authentik.@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 same issue as before.
@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4
I also tried with this nginxproxymanager config, but the issue persists:
Here the log:
my config again:
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 so you are accessing it from
https://gitea-mirror.redacted.devright? or fromhttp://10.10.20.45:4321?@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 via domain, locally through the IP is only in spcacial circumstances to fix /debug things, but there I don't mind SSO not working.
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 can you wipe your existing Authentik provider (create a new provider with a fresh
providerId) and add it again on
v3.8.10on a fresh install using Discover so the normalized config (with token endpoint) gets stored.@CrazyWolf13 commented on GitHub (Oct 26, 2025):
@arunavo4 wow, that actually fixed it, recreating the provider in gitea-mirror only was sufficient.
Thanks a lot!
@arunavo4 commented on GitHub (Oct 26, 2025):
@CrazyWolf13 awesome I will update some of the methods so that this will be a warning for users using older versions. and will link all these issues in readme if people get these issues.