Sharing user's folders from Admin user via the shape API


I’m currently developing a front-end app that’s gonna use NC as a file system.
NC and my app are on the same server and i’m managing the file mostly locally via my API.

Let me give a context:
On my app, there a company manager which can create new company.
When he does:

  • A NC group is created with name of the company (via group API)
  • A new NC user is created at the name of the company. ( via user API)
  • All needed directories are created in one master dir for the new user (Locally + cron that sync NC and local)
  • Share the master folder for the company with the group previously created (Share API)
  • Add the company manager to the group (User API)

The bold step is the one that causes me troubles. I can do every other step from the admin user using the NC APIs but when i want to share, it only allows me the root dir of the user which make the request which makes sense of course.
The problem is, at this oint, the user created doesn’t have set his password yet and even if he had, I don’t have that password anywhere so i can use the share API to share the folder.

Has anyone already got that issue ? Any solution ?


Sounds kind of similar to how the moodle integration works. Try oauth :wink:

Thanks fo your answer, I’ve been watching about OAuth but i’m not sure it gonna fix my issue.
I’ve tried to insert my sharing directly in the NC database but weirdly, folders do not display on NC. Must have missed something

EDIT: Alright, the only way I found it easy is to call the nextcloud database from my Api and it works.
Maybe not the best solution but a working one for sure.