Ask A Question

Notifications

You’re not receiving notifications from this thread.

Any one help in pointing to a resource or webcast which explains how to interact with Google Drive API

Anand Duddella asked in Gems / Libraries

I am very new to rails and trying to build an app which can interact with Google DRIVE Api V3. I have scaffolded a Rails 5 App and used Devise Gem along with Google OmniAuth2 to authenticate and register the user and grant access to his Drive. But according to https://github.com/google/google-auth-library-ruby we need to get authorization token before making the API call.

I am not able to find any example as even the Google Drive example the Ruby example is deprecated

Any help would be greatly appreciated

Reply

Great idea. The google API is definitely not the simplest API to work with in Rails because it's so generic. I will definitely try to cover it soon.

For some help in the meantime, the main things you're going to need is to make sure that your scope is set properly for Drive authorization. That will make sure once you have keys you can access Drive with them. I would probably recommend using this library over the google one because this does the same thing but is setup nicely to work within Omniauth which Devise supports. Configuration is super easy and will save you a lot of time: https://github.com/zquestz/omniauth-google-oauth2

Reply

Hi Chris

Thank you for the reply really appreciate your pointers. After leaving the comment on the website I have tried and am able to integrate Rails with Devise and Google Omniauth2 . So currently my app users can sign up with their google credentials and while signing up for the first time Google sends back the access_token and refresh token . I have persisted the refresh token into the DB. The part where it gets tricky for me is using rails how do i now send a post request to Google using Google API.

The example Google mentions is not using rails and is really not helpful. Hopefully you can cover this soon.

Looking forward to it. Thank you once again

Reply

Depending on what you want to do now, you can use something like this to work with their API: https://github.com/gimite/google-drive-ruby

You'll just pass in the access token you received from omniauth into this library to hit their API.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.