Custom external page after logout

Hi everyone.

I like to redirect a user to an external page when he logout from nextcloud.

How can I accomplish that?

It’s not possible to do this at the moment. You can try to hack the code yourself:

You could file a feature request on Issues · nextcloud/server · GitHub (perhaps such a request already exists).

Is it now possible ?

As far as I know, this still does not exist. Overall, I don’t think it makes sense either.

For security reasons, you should always log in to Nextcloud directly on the Nextcloud page, e.g. https://cloud.server.tld, and not via other channels.

As a result, it only makes sense to return to this page after logging out.

Why do you need it? Have you made any changes to the login page? Which page do you want to access? What should it display?

Not 100% sure if that is the right place, but here is a logout function:

You could try to do a redirect to a custom page here. Not sure if there are perhaps side effects on the client or other things. I just looked for “logout” in the code, so be very careful what you are doing.

If you want something a bit more official and that you don’t have to hack it in after each update, you could try to create an app doing that. But I have no idea if you can do that with an app.

We use an SSO portal with SAML authentication for Nextcloud.

When users arrive at the Nextcloud login page, they are either already authenticated via the SSO and are automatically logged in, or they are redirected to the portal, authenticate, and are then immediately returned to Nextcloud. This is the normal behavior.

However, when they use the logout function in Nextcloud, they are redirected back to the same Nextcloud login page, and the SAML authentication process starts again. This creates an issue for us: the user enters the SSO login flow and is immediately logged back into Nextcloud, despite their intent to log out.

What we would like is for users to be redirected to the SSO portal login page after logging out of Nextcloud (without triggering the SAML authentication process through the login Nextcloud page). From there, they can access the SSO portal, which offers various applications, including Nextcloud as just one option among others.

Yes, we hope an official solution, but this is interesting.
thanx !

I’m not aware if such options exist for SAML but with more modern OIDC using user_oidc there are many different options to control logout from the app e.g. call special end_session_endpoint, use single_logout and configure custom URL in case IdP doesn’t support end_session_endpoint

Thanks for these tips, I’ll take a closer look.

We chose SAML because it seemed to be part of Nextcloud’s main code and we therefore thought that in the long term it offered guarantees in terms of monitoring and reliability as opposed to external modules.

Wouldn’t that be a good way of thinking about Nextcloud’s long-term development?