Skip to content

Instantly share code, notes, and snippets.

@hectorups
Created April 8, 2014 22:59
Show Gist options
  • Save hectorups/10205857 to your computer and use it in GitHub Desktop.
Save hectorups/10205857 to your computer and use it in GitHub Desktop.
google plus problem
def gapi_authorization(code)
# Read in the client secrets
client_secrets = {
temporary_credential_uri: 'https://www.google.com/accounts/OAuthGetRequestToken',
authorization_uri: 'https://accounts.google.com/o/oauth2/auth',
token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
client_id: '711346440759-xxx.apps.googleusercontent.com',
client_secret: 'xxx',
redirect_uris: [ "oob" ]
}
authorization = Signet::OAuth2::Client.new(
authorization_uri: client_secrets[:authorization_uri],
token_credential_uri: client_secrets[:token_credential_uri],
client_id: client_secrets[:client_id],
client_secret: client_secrets[:client_secret],
scope: 'https://www.googleapis.com/auth/plus.login')
unless code.nil?
authorization.redirect_uri = client_secrets[:redirect_uris].first
authorization.code = code
authorization.fetch_access_token!
end
return authorization
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment