Google Drive Media Source

Hi everyone,

I feel like I need to revive this thread a little because a lot of things happened in the past few years. Google Drive on MediaSources | MODX Community Forums - This was very interesting and we kind of lost touch of it because we just pushed our files from a synchronized drive directly to the site. However, I think it’s inferior do wiring up Google Drive directly.

I remember grive from before we were using insync and it worked really great. I also know that OAuth2 for Google has been implemented several times and that @markh probably has a lot of reference code for performing this.

So. My question is: Is this still on anybody’s radar? Is somebody maybe even working on something like this? I like the idea of wiring up a Google Drive with MODX, especially because it makes workflows so much easier when working with larger companies with a lot of teams and branches.

I’d be curious about any kind of progress for this integration because I remember that this came up ages ago in a MODXpo and I haven’t seen any working integration so far.

1 Like
  1. Initialising the Google SDK OAuth2 object: BigBrother/bigbrother.class.php at 83e3ef0b8d2b9b279bfa0fb971dc2c2f199cc8a8 · modmore/BigBrother · GitHub
  2. Creating an authorization url, note this takes configuration from the OAuth2 object (in this case, out-of-band redirects meaning the user will be asked to copy/paste a code) BigBrother/authorize.class.php at 83e3ef0b8d2b9b279bfa0fb971dc2c2f199cc8a8 · modmore/BigBrother · GitHub
  3. Verifying the code and turning it into a refresh + access token: BigBrother/verify_code.class.php at 83e3ef0b8d2b9b279bfa0fb971dc2c2f199cc8a8 · modmore/BigBrother · GitHub

Fairly straightforward (after you’ve spent hours digging through docs and source code).

When doing it as a media source, you do lack the ability to do an authentication flow so that might need some more creative development. Perhaps the Dropbox media source has inspiration on how to do that, I seem to recall that may have done something with defining the properties dynamically to provide the authorization link?

Or you could just ship a CMP for the authentication and instruct the user where to paste the refresh token once created.

Final note; media sources in MODX3 can be built with Flysystem. I’d be surprised if there isn’t already a Google Drive adapter for that floating around somewhere to make the implementation easier. Happy to provide you a quote if you want this developed.