Skip to content

Instantly share code, notes, and snippets.

@AnalogJ
Last active December 21, 2015 13:49
Show Gist options
  • Save AnalogJ/6315128 to your computer and use it in GitHub Desktop.
Save AnalogJ/6315128 to your computer and use it in GitHub Desktop.
Google Signet Gem OAuth2 Example
oauth_client = Signet::OAuth2::Client.new(authorization_uri: 'https://accounts.google.com/o/oauth2/auth', token_credential_uri: 'https://accounts.google.com/o/oauth2/token', client_id: 'CLIENT_ID', client_secret: 'CLIENT_SECRET', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', scope: 'https://www.googleapis.com/auth/tasks')
oauth_client.authorization_uri
# => #<Addressable::URI:0x1223b74 URI:https://accounts.google.com/o/oauth2/auth?client_id=CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/tasks>
oauth_client.update! code: 123456
oauth_client.authorization_uri
# => nil
oauth_client.client_id
# => nil
oauth_client.client_secret
# => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment