Reputation: 395
Google OAuth 2.0 Access Token's have an expiry time. I have integrated the Google Calendar API into my Ruby application however the problem is access token is expiring. How can I make the access token long lived one.
cal.login_with_refresh_token('ksdjkf_sdfkasdhfjhaskjdhfkasdhfkasjdlfasld')
{ "access_token" => "ksdjkf_sdfkasdhfjhaskjdhfkasdhfkasjdlfasld",
"token_type" => "Bearer",
"expires_in" => 2324
}
How to make this a long lived one which means untill unless he revokes access from his Google account user can be able to fetch his Calendar events.
Upvotes: 0
Views: 1168
Reputation: 214
Here's how to create a long-lived OAuth token for the Google API:
Here's an example of using that oauth token with the ruby-api-client gem to talk to the Google Play API using signet. You should be able to modify this example to instead use the calendar API pretty easily:
https://gist.github.com/jkotchoff/e60fdf048ec443272045
Note this was inspired by: https://www.youtube.com/watch?v=hfWe1gPCnzc
Upvotes: 1