I have both Moodle and Nextcloud installed with nginx, and followed the docs on how to add nextcloud as oauth2 and create a repository. Everything seems be correctly setup, with an exclusive nextcloud system account for moodle linked to the oauth2 service.
But when I try to use the nextcloud repository created, I get no files available.
The only thing on the docs that I could not double check was this part:
Since I am using nginx, is there any configuration that should be done specifically either in Moodle's our NC server's side?
I think the most likely cause for your issue is that you are running Nextcloud on nginx. Nextcloud does not (officially) support being installed in an nginx environment; the official documentation relies entirely on Apache. Most of the WebDAV things (which Nextcloud uses a lot) are only tested well on Apache. However, I found some community-maintained documentation for nginx here: https://docs.nextcloud.com/server/15/admin_manual/installation/nginx.html. Maybe that helps?
If it does not; are you using self-signed certificates? The "no files available" notice always comes up if you are using a self-signed cert on the Nextcloud end. PHP (and, therefore, Moodle) is not able to deal with those and will silently reject them (resulting in this particular warning).
Thanks a lot for your attention and kindness in replying.
I think I had used the official doc you commented to setup my instance. As far as I can tell, everything was supposed to be working. Even logging in through moodle's android app works.
But maybe there is something that changed or has been added on the docs. I will check again and report back.
The certificate I'm using is not self-signed, it's a Let's Encrypt one. Just double checked and the current one is valid until April.
Both Moodle and Nextcloud are on the same instance, could that interfere in any sense?
Let's Encrypt should be fine. The fact that Moodle and Nextcloud are on the same server should not be an issue either. Unless, maybe, this results in different hostnames (for example, maybe the public hostname of your server cannot be resolved locally - that would be an issue, because after authorisation Moodle talks to Nextcloud directly using that hostname).
in my experience, the issues with misconfigured WebDAV + headers are hard to notice, i.e. everything appears totally fine except for a few very special requests that fail without a helpful error message. For example, I have no idea whether the rather special combination of Nextcloud's OAuth + WebDAV + nginx works, and whether those behind that documentation have even tried it. (For example, on misconfigured Apaches, the OAuth authentication header is just dropped without notice - but everything else is fine.)
If you double-checked the configuration and it doesn't work yet, you could try two things. You could ask the Nextcloud community for help on their forums. Maybe they have experience with nginx + OAuth that they are willing to share. Alternatively, try setting up your Nextcloud on an Apache following the official documentation; then try connecting to that.
Good luck, hope this helps!
I've double-checked the nginx configuration, did some minor tweaks, but it still does not work.
I'll try to reach the nextcloud forum, then.