Configuration of your Nextcloud instance
Your Nextcloud instance has to allow RSpace to log in as an OAuth client. In addition, if RSpace and Nextcloud are installed in different domains, your Nextcloud instance has to allow Cross Origin Requests (CORS) from the RSpace domain.
Configure OAuth on Nextcloud:
You (or the Nextcloud Admin) will need to set up RSpace as an OAuth client in Nextcloud, this will display a clientID and clientSecret for you/RSpace staff to copy into the deployment properties for the relevant RSpace install.
1) As Nextcloud Admin go to the nextcloud security section.
2) Add a new Oauth2 client, for redirection url use <Rspace host>/nextcloud/redirect_uri
3) Click 'Add'. Nextcloud generates a clientID and clientSecret for you to copy.
Configure Cross Origin Requests (CORS) on Nextcloud:
One solution is to install the 'WebAppPassword' app and then enter the RSpace domain as an allowed domain, after that all CORS issues are removed.
WebAppPassword is available in the nextcloud App store and install is a simple few clicks. Go to 'Admin' profile (on right of screen) and click on that and then click on 'Apps' to get to the App store for Nextcloud.
WebAppPassword is found in the security section of the Apps page:
Once installed, go to 'Admin' -> Settings -> 'WebAppPassword' is shown on the left of the screen under the 'Administration' section. Enter your RSpace host under 'allowed origins' and click on the 'set origins' button.
Configuration of your RSpace server
1) Edit your RSpace deployment.properties in /etc/rspace and add the following at the bottom
nextcloud.client.id=[ID FROM NEXTCLOUD]
nextcloud.secret=[SECRET FROM NECTCLOUD]
nextcloud.url=[YOUR NEXTCLOUD URL]
nextcloud.server.name=[DISPLAY LABEL, e.g. My NextCloud]
2) Restart tomcat on your RSpace server
Allowing the use of Nextcloud
The Integration is disabled by default, an RSpace sysadmin must enable this Integration by the usual mechanism on the 'system'-> 'configuration' -> 'system settings' page. The property is called 'nextcloud.available'.
Using Nextcloud in RSpace
Connecting to Nextcloud:
Every user of the Integration must log into Nextcloud using their Nextcloud credentials to obtain an OAuth token to be used by RSpace. This is performed by going to the 'Apps' page in RSpace, 'Enabling' the Integration and then clicking on the 'connect' button.
You will be taken to a Nextcloud login page:
If you have not configured your RSpace instance as an OAuth client for Nextcloud (see above), you will instead see the following:
Once authenticated with Nextcloud you will be redirected back to RSpace and you can close the Apps page and open your workspace.
When editing a document, you will now see a 'Nextcloud' icon in the toolbar. (If there is no Nextcloud icon you may have forgotten to enable the Integration, which you have to do as well as connecting to Nextcloud).
Clicking on the Nextcloud icon opens a file chooser with your Nextcloud documents visible:
Finally, saving the document leaves links to any chosen Nextcloud files embedded in the document.
Clicking on a link opens Nextcloud in a new browser tab. If the file can be rendered in the browser, it will be opened. For example, linking to 'Nextcloud Manual.pdf' will open with your browser's built in pdf viewer. Nextcloud can occasionally hang while attempting to render a file in the browser. If this happens, press 'cancel'. If the file cannot be rendered in the browser (or you pressed 'cancel' while Nextcloud attempted to render the file), Nextcloud will open the directory containing the file, scroll to the file and highlight it. Nextcloud may also download the file. You can find examples of files that might not open in your Nextcloud 'Templates' directory. The following screen shot shows the result of pressing 'cancel' as Nextcloud attempted to render the file 'Templates/Simple.odp' that was linked from RSpace.