0

Can omniauth-google-oauth2 be used also to get calendar info back from the google calendar API?

I have managed to so far to get: a) omniauth-google-oauth2 test rails app working to "sign on with google" in test app 1 b) OAuth Plugin to get calendar data via the Oauth Calendar Data API in test app 2.

QUESTION is whether I could drop the use of "OAuth Plugin" and just use "omniauth-google-oauth2" to also (after authentication) get the calendar data? If yes, how would this work? Are the OAuth tokens the same from google for the authentication & google calendar api aspects?

Greg
  • 34,042
  • 79
  • 253
  • 454

2 Answers2

1

Yes, it can be used to get calendar data.

I only use the omniauth-google-oauth2 gem for calendar access. I would assume it works the same way as the oauth plugin with the token.

Check out this to get started https://github.com/deafgreatdane/google_oauth_calendar

Larry Mai
  • 53
  • 1
  • 6
0

For future searchers:

You can simply include calendar in the scope for your google_oauth2 provider.

provider :google_oauth2,
         ENV["GOOGLE_OAUTH2_APP_ID"],
         ENV["GOOGLE_OAUTH2_APP_SECRET"],
         { scope: 'email,profile,calendar' }

More details here.

Andrew Smith
  • 1,434
  • 13
  • 29