nextcloud / nextcloud/user_oidc

Authentication to external OIDC server (Keycloak) does not work - error "Too many redirects"

Open
#446 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs info
Dominant language
PHP
Stars
181
Forks
60
Avg merge
7h 34m
Merged PRs (30d)
26

Description

I've configured the plugin as per documentation (https://www.schiessle.org/articles/2020/07/26/nextcloud-and-openid-connect/), but with the difference that my OIDC server does not run on the NC VM, it's available via its own domain.

I've configured the correct authentication endpoint for my Keycloak server in the app : https://mykeycloak.de/realms/cloud/protocol/openid-connect/auth

... and of course the correct client id and secret.

Clicking on the "Login with Keycloak" button on the NC login page leads to an error message "Too many redirects".

Watching the network requests in the browser console, at no point the auth endpoint of my Keycloak server is addressed. All requests are done to "https://cloud.mydomain.de/apps/user_oidc/login/1", looking like this:

https://cloud.mydomain.de/apps/user_oidc/login/1?client_id=keycloak&response_type=code&scope=openid+email+profile&redirect_uri=https://cloud.mydomain.de/apps/user_oidc/code&claims={"id_token":{"email":null,"name":null,"quota":null},"userinfo":{"email":null,"name":null,"quota":null}}&state=6XD043WIXV4L979X8087KRG8IVIBBBNC&nonce=B8Z2U1EPG0XYLHFIYIBLAU1TU4XC9NED

Is this issue already known? Anyone got this working with Keycloak on an external domain not running on the NC server itself?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the login flow from the Nextcloud login page and inspect the repeated /apps/user_oidc/login/1 requests described in the issue. Compare the configured external Keycloak authentication endpoint with the observed redirects; done means the flow reaches that endpoint and no longer ends in a redirect loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.