Skip to content

Instantly share code, notes, and snippets.

Greg Baugues GregBaugues

Block or report user

Report or block GregBaugues

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@GregBaugues
GregBaugues / token.rb
Last active Jul 6, 2019
Google API OAuth 2.0 refresh token (Ruby on Rails)
View token.rb
# The OAuth access token provided by the Google API expires in 60 minutes. After expiration,
# you must exchange a refresh token for a new access token. Unfortunately, the the Google API
# ruby gem does not include a method for refreshing access tokens.
# You can read up on how to refresh an access token here:
# https://developers.google.com/accounts/docs/OAuth2WebServer#refresh
# This Token model implements that process. It's based off of a Token model that can be created
# by running:
# rails g model Token token:text refresh_token:string expires_at:datetime
You can’t perform that action at this time.