Incorrect redirect URI when logging in with authentik

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

The Basics

  • Nextcloud Server version:
    • 32.0.5
  • Operating system and version:
    • TrueNAS 25.04.2.6
  • Web server and version:
    • Apache 2.4.66
  • PHP version:
    • 8.3.30
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • upon configuring authentik
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • TrueNAS app
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • Cloudflare tunnel

Summary of the issue you are facing:

I have configured Nextcloud to have a sign in option for authentik. I have set the redirect URI to https://nextcloud.DOMAIN.net/apps/user_oidc/code and when I click the “login with authentik” button on the Nextcloud login page I get the error:

Redirect URI Error

The request fails due to a missing, invalid, or mismatching redirection URI (redirect_uri).

I have previously set up authentik with Immich so I know that is working. It might be worth noting that when I access this URI through a regular browser I get a 404.

Hello @ChickenDipps,
welcome to the Nextcloud community :handshake:

You’ve posted a request in the support section. Unfortunately you have not provided enough informations especially logs from the browser, application, IdP and reverse proxy (cloudflare, TrueNAS).
Please edit your post and add as much information as possible so that community supporters have the necessary technical information to help you resolve your issue! see support template

Regards,
wwe

In general I can confirm the redirect URL is valid and I use this URL in my working OIDC integration with Keycloak. In my working installation if I visit the URL there is an error and no 404, so likely there is a misconfiguration in your webserver or reverse proxy components

Access forbidden
The received state does not match the expected value.