# SSO autologin to Nextcloud

**URL:** https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458
**Category:** Support
**Tags:** english
**Created:** [October 11, 2021, 12:36pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458 "2021-10-11T12:36:36Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![grubshka](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@grubshka](https://forum.yunohost.org/u/grubshka)
#### Post date: [October 11, 2021, 12:36pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/1 "2021-10-11T12:36:36Z")

</div>

### My YunoHost server

**Hardware:** VPS bought online  
**YunoHost version:** 4.2.8.3  
**I have access to my server :** Through SSH | through the webadmin  
**Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?** : no

### Description of my issue

Hi,

I’ve a simple question about SSO.  
I installed the Nextcloud application, and I was expected to be automatically logged in to nextcloud if I was already logged in to Yunohost.  
Is this the way it should work ?  
And if so, what could I check to solve this bug ?

Best regards,

–  
Pierre

---

<div class="post-metadata">

### Author: ![wbk](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/w/e0b2c6/32.png) [@wbk](https://forum.yunohost.org/u/wbk)
#### Post date: [October 13, 2021, 8:09am UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/2 "2021-10-13T08:09:13Z")

</div>

Hi Pierre,

SSO is supposed to log you in to Nexctloud when you click on the coloured square after you logged in to Yunohost.

There are ways to break it, I think, for example by changing your password in Nextcloud.

Do your other apps work with SSO or do they have problems as well?

Have you been using Nexctloud for a while by now, or would it be easier to reinstall Nextcloud instead of troubleshooting?

---

<div class="post-metadata">

### Author: ![grubshka](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@grubshka](https://forum.yunohost.org/u/grubshka)
#### Post date: [October 13, 2021, 3:03pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/3 "2021-10-13T15:03:50Z")

</div>

Hi,

Thank you for your answer.

Our other apps does not seem ready for SSO (Mailman3, Gitea).  
But I can install any app for testing, if you recommend one 🙂

We were using Nextcloud for years, and we migrated to Yunohost a few month ago.  
We develop some scripts to re-create data in Nextcloud, but the users were created through the Yunohost API.  
So, maybe there was something wrong here ?  
It would be possible to reinstall Nextcloud, but it would take some time.

A maybe-related bug : regularly, some users can’t login to Nextcloud, without any error message (neither the website, nor the JS console, nor the server logs).  
We need to clear cookies in order to login again.

Regards

---

<div class="post-metadata">

### Author: ![grubshka](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@grubshka](https://forum.yunohost.org/u/grubshka)
#### Post date: [October 13, 2021, 3:05pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/4 "2021-10-13T15:05:04Z")

</div>

We think we found a possible cause : yunohost is installed in a subdomain, and Nextcloud is using another “sibling” subdomain !  
So the cookie domain is wrong…

---

<div class="post-metadata">

### Author: ![wbk](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/w/e0b2c6/32.png) [@wbk](https://forum.yunohost.org/u/wbk)
#### Post date: [October 13, 2021, 3:10pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/5 "2021-10-13T15:10:25Z")

</div>

> [@grubshka](#):
>
> So the cookie domain is wrong…

Sharp! In my cases, Nextcloud is either installed on the Yuno-domain in a subdirectory (eg, online.osba.nl/nextcloud, with online.osba.nl as main domain), or in a subdomain of the Yuno-domain (cloud.fakraz.nl with the main domain at fakraz.nl).

In your case, I expect Yunohost’s main domain to be (for example) [yunohost.grubhska.fr](http://yunohost.grubhska.fr), with Nextcloud on [nextcloud.grubhska.fr](http://nextcloud.grubhska.fr) ? Still, both are installed on the same server, are they not?

---

<div class="post-metadata">

### Author: ![grubshka](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@grubshka](https://forum.yunohost.org/u/grubshka)
#### Post date: [October 14, 2021, 8:28am UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/6 "2021-10-14T08:28:54Z")

</div>

That’s it, everything is on the same server.

Because of the migration we made wrong decision about subdomains : before Yunohost, we had only Nextcloud on [cloud.domain.com](http://cloud.domain.com).  
So, we installed Yunohost on [cloud1.domain.com](http://cloud1.domain.com) and Nextcloud on [cloud.domain.com](http://cloud.domain.com).  
But this still needed users to change their email client configuration…

So we just decided to change everything and make a clearer configuration.  
We can’t put Yunohost on [domain.com](http://domain.com) because it’s the website of our association.

Ideally, we would have Yunohost on something like [portal.domain.com](http://portal.domain.com), and nextcloud on [cloud.domain.com](http://cloud.domain.com), however I don’t like email server to be “[portal.domain.com](http://portal.domain.com)” 🙂  
I don’t know if we can have a different subdomain for email server, I tried but I had client complaining about wrong certificate domain, and I saw wildcard certificate are not yet supported.

We need some more reflexion and investigation here !

---

<div class="post-metadata">

### Author: ![wbk](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/w/e0b2c6/32.png) [@wbk](https://forum.yunohost.org/u/wbk)
#### Post date: [October 15, 2021, 5:21pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/7 "2021-10-15T17:21:33Z")

</div>

> [@grubshka](#):
>
> So we just decided to change everything and make a clearer configuration.  
> We can’t put Yunohost on [domain.com](http://domain.com) because it’s the website of our association.

I think it is possible to:

- move the website at [https://domain.com](https://domain.com) to eg. [https://www.domain.com](https://www.domain.com)
- install Yunohost on [domain.com](http://domain.com)
- install the redirect-app in Yunohost
  - make the redirect-app point to [https://www.domain.com](https://www.domain.com)
  - make the redirect-app the default application

The idea is to have no change for visitors of [https://domain.com](https://domain.com), because they can keep visiting the old address, and Yunohost will forward them.

I see two possible problems:

1. Yunohost will try to catch all traffic to addresses on the domain and redirect to the default page, or another configured page/app. There is, in this case, no domain configured and no app installed at [www.domain.com](http://www.domain.com) (at least, not in Yunohost). I think the definition of the domain [www.domain.com](http://www.domain.com) is needed in Yunohost, perhaps in combination with installation the ‘custom webapp’ on [www.domain.com](http://www.domain.com) to ‘punch a hole’ in Yunohost security to allow access to your website.
2. Existing links (on the web) to [https://domain.com/news/2021/new\_website\_is\_live](https://domain.com/news/2021/new_website_is_live) (for example), might break: they will be redirected to [https://www.domain.com](https://www.domain.com). I am quite sure that the redirect app can be configured to correctly forward to [https://www.domain.com/news/2021/new\_website\_is\_live](https://www.domain.com/news/2021/new_website_is_live) (including the www in front). The redirect app is an Nginx-configuration, and is quite flexible.

Thinking some more about it, maybe you can even install _both_ Yunohost and the association website at the main domain, as long as you configure the custom web app in Yunohost to allow traffic to your website (for each of the paths in your website, so perhaps you need a custom webapp for [https://domain.com/news](https://domain.com/news), one for [https://domain.com/contact](https://domain.com/contact), etc).

---

<div class="post-metadata">

### Author: ![system](https://forum.yunohost.org/uploads/default/original/2X/f/f59fe8e3ee6b100b4f574d30d6e30479c68b89f0.png) [@system](https://forum.yunohost.org/u/system)
#### Post date: [November 14, 2021, 5:22pm UTC](https://forum.yunohost.org/t/sso-autologin-to-nextcloud/17458/8 "2021-11-14T17:22:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
