26. Application based user settings
To share user settings across devices applications want to store user specific settings on the server. The ePUB app wants to remember which page the user is on. The iOS app wants to rember search queries. The Caldav app needs a space to store data.
- OCS provisioning API
- settings service
- libregraph API
Chosen option: ???
- TODO
- TODO
Nextcloud added a /ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}
endpoint
- Bad, legacy API we want to get rid of
- Bad, yet another API. Always uses POST requests.
The MS Graph API has a special approot driveItem that apps can use to store arbitrary files. See also: Using an App Folder to store user content without access to all files and a blog post with the section Store data in the application’s personal folder.
It basically uses the /me/drive/special/approot:/{filename}
endpoint to
PUT https://graph.microsoft.com/v1.0/me/drive/special/approot:/settings.json:/content
content-type: text/plain
authorization: Bearer abc
{"key": "value"}
or
GET https://graph.microsoft.com/v1.0/me/drive/special/approot:/settings.json:/content
authorization: Bearer abc
On single page apps you need two requests:
GET https://graph.microsoft.com/v1.0/me/drive/special/approot:/settings.json?select=@microsoft.graph.downloadUrl
authorization: Bearer abc
followed by
GET <url from the response['@microsoft.graph.downloadUrl'] property>
Currently, applications have no dedicated tokens that we could use to derive the appid
from. All apps should have an appid
and be discoverable under
GET /applications
In any case for libregraph we could introduce a LIBRE_GRAPH_APPID
header to make these requests possible rather soon.
Then we can decide if we want to store these files in the users personal drive, or if we create a space for every app that then uses the userid as a folder that contains all the files for the user.
- Good, because clients can remain in libregraph API land
- Bad, we currently have no application tokens