user_oidc icon indicating copy to clipboard operation
user_oidc copied to clipboard

Allow sub path for Nextcloud

Open c-cal opened this issue 3 years ago • 2 comments

When Nextcloud is not served at the root (ie: https://xxx.com/nextcloud), the post-authentication redirection fails if access is attempted via any sub-URL. For example in the case of https://xxx.com/nextcloud/apps/dashboard/ the portion of the path representing the root of the instance (ie: /nextcloud) is lost during the redirection: https://xxx.com/apps/dashboard/ => obviously leading to a 404 error.

c-cal avatar Dec 12 '22 19:12 c-cal

I can't reproduce the issue. This is supposed to work as the redirect_uri Nextcloud gives to the provider's authorization endpoint is generated correctly as far as I've seen in the code.

This might be a config issue on your side. Maybe your subpath is not included in overwrite.cli.url in your Nextcloud config.

julien-nc avatar Mar 10 '23 11:03 julien-nc

I've encountered the same issue; the callback to https://xxx.com/nextcloud/apps/user_oidc/code leads to a redirect to /apps/dashboard, thus giving https://xxx.com/apps/dashboard instead of https://xxx.com/nextcloud/apps/dashboard. I've checked the configuration of the overwrite.cli.url and overwrite.cli.webroot, both are setup correctly.

After searching a bit through the codebase, it seems that the redirect url given by Nextcloud to the /nextcloud/login route (then /nextcloud/apps/user_oidc/login/1) is only the path on the nextcloud instance, /apps/dashboard in this example. When the user comes back from the provider, on https://xxx.com/nextcloud/apps/user_oidc/code, the function simply returns the redirect_uri stored in the session (here), causing to the issue.

If I understand correctly, it should instead use the URLGenerator::linkToRoute to include webroot to the redirection.

Thechi2000 avatar Aug 27 '24 12:08 Thechi2000