Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wintercms/wn-drivergoogledrive-plugin
Driver that adds support for Google Drive as a filesystem to Winter CMS.
https://github.com/wintercms/wn-drivergoogledrive-plugin
Last synced: about 1 month ago
JSON representation
Driver that adds support for Google Drive as a filesystem to Winter CMS.
- Host: GitHub
- URL: https://github.com/wintercms/wn-drivergoogledrive-plugin
- Owner: wintercms
- License: mit
- Created: 2023-08-12T08:09:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-12T08:11:53.000Z (over 1 year ago)
- Last Synced: 2024-04-14T00:37:59.258Z (8 months ago)
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wintercms - Winter.DriverGoogleDrive - Driver that adds support for Google Drive as a filesystem to Winter CMS. (Uncategorized / Uncategorized)
README
# Google Drive Filesystem Driver for Winter CMS
Provides the [Google Drive](https://www.google.com/drive/) filesystem driver for [Winter CMS](https://wintercms.com/) using [masbug/flysystem-google-drive-ext](https://github.com/masbug/flysystem-google-drive-ext).
## Installation
This plugin is available for installation via [Composer](http://getcomposer.org/).
```bash
composer require winter/wn-drivergoogledrive-plugin
```## Usage
For usage examples of interacting with this driver see the usage examples here: [ivanvermeyen/laravel-google-drive-demo#available-routes](https://github.com/ivanvermeyen/laravel-google-drive-demo#available-routes)
## Configuration
Example Storage disk configuration using the `googledrive` storage driver provided by this plugin:
'mygoogledrive' => [
'driver' => 'googledrive',
'clientId' => '',
'clientSecret' => '',
'refreshToken' => '',
'folder' => '',
],See the following Configuration Guides for how to get the values for `clientId`, `clientSecret`, `refreshToken`, & `folder`.
## Configuration Guides
### Getting your Client ID and Secret
Log in to your Google Account and go to this website:
https://console.developers.google.com/
#### Create a Project
Create a new project using the dropdown at the top.
After you enter a name, it takes a few seconds before the project is successfully created on the server.
#### Enable Drive API
Make sure you have the project selected at the top.
Then go to Library and click on "Drive API" under "G Suite APIs".
And then Enable it.
#### Create Credentials
Go to "Credentials" and click on the tab "OAuth Consent Screen". Fill in a "Product name shown to users" and Save it. Don't worry about the other fields.
Then go back to Credentials, click the button that says "Create Credentials" and select "OAuth Client ID".
Choose "Web Application" and give it a name.
Add https://developers.google.com/oauthplayground in "Authorized redirect URIs". You will need to use this in the next step to get your refresh token. Once you have the token, you can remove the URI.
Click Create and take note of your **Client ID** and **Client Secret**.
### Getting your Refresh Token
Go to https://developers.google.com/oauthplayground.
> Make sure you added this URL to your Authorized redirect URIs in the [previous step](1-getting-your-dlient-id-and-secret.md).
In the top right corner, click the settings icon, check "Use your own OAuth credentials" and paste your Client ID and Client Secret.
In step 1 on the left, scroll to "Drive API v3", expand it and check the first drive scope.
Click "Authorize APIs" and allow access to your account when prompted.
There will be a few warning prompts, just proceed.When you get to step 2, check "Auto-refresh the token before it expires" and click "Exchange authorization code for tokens".
When you get to step 3, click on step 2 again and you should see your **refresh token**.
### Getting your Root Folder
If you want to store files in your Google Drive root directory, then the folder ID can be `null`. Otherwise, go into your Drive and create a folder and then provide the path to that folder for this value.