Skip to content

hevelius/files_external_onedrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Files External Onedrive

external storage support for NextCloud

License: GPL v2 Build Status codecov Donate

Requirements:

  • php with zlib support
  • files_external app must be enabled ❗

Steps For Installation:

  • Get the code
$ cd /server_path/apps
$ git clone https://github.com/hevelius/files_external_onedrive
$ cd files_external_onedrive
$ composer install
  • Activate the files_external app from NC settings page or cli
$ cd /server_path/
$ php -f occ app:enable files_external
  • Activate files_external_onedrive from NC settings page or cli
$ cd /server_path/
$ php -f occ app:enable files_external_onedrive
  • Fill up the storage details (See Below Configuring OAuth2)
  • Fire up the files page to see the OneDrive mounted as external storage

Configuring OAuth2

Connecting OneDrive is a little more work because you have to create a onedrive app.

Create new app
  • Click New registration
  • Name Your App
  • Make sure to select:
    Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)

  • For Redirect URL (optional) add the following URL http://path/to/nextcloud/index.php/settings/user/externalstorages (Replace http://path/to/nextcloud/index.php with you valid Nextcloud installation path, ensure that you don't leave index.php in the path. Example: https://nextcloud.myserver.com/settings/admin/externalstorages)
  • Click Register to create your app.
Add client secret
  • Under the section Certificates and secrets add new client secret, Name, choose expires:never.
    Make sure to copy the created key (you will not be able to do that later on). Key needs to be pasted in Nextcloud in last step
Add permissions to app
  • Under the section API permissions
  • Click add a permissions
  • Choose Microsoft Graph, Delegated permissions
  • add auth for [ User.Read | Files.ReadWrite.All | offline_access ] (the last is necessary to perform a correct token refresh)
On Nextcloud
  • Copy Client Id and client secret then Go to Nextcloud /settings/user/externalstorages and Add a new storage OneDrive
  • Fill the details Client Id, Client Secrets from you onedrive App page
  • Click Grant Access and then you will be redirected for OAuth login
  • After completing the OAuth you will be redirect back to Storage Section and you should see green mark along your storage configuration

References: