lib/gplus/client.rb in gplus-2.0.0 vs lib/gplus/client.rb in gplus-2.0.1
- old
+ new
@@ -46,19 +46,20 @@
# Generate an authorization URL where a user can authorize your application to access their Google+ data.
# @see https://code.google.com/apis/accounts/docs/OAuth2WebServer.html#formingtheurl The set of query string parameters supported by the Google Authorization Server for web server applications.
#
# @param [Hash] options Additional parameters used in the OAuth request.
- # @option options [String] :redirect_uri An optional over-ride for the redirect_uri you initialized the API client with.
+ # @option options [String] :redirect_uri An optional over-ride for the redirect_uri you initialized the API client with. This must match the redirect_uri you use when you call #get_token.
# @option options [String] :access_type ('online'). Indicates if your application needs to access a Google API when the user is not present at the browser. Allowed values are 'online' and 'offline'.
# @return [String] A Google account authorization URL for your application.
def authorize_url(options = {})
defaults = { :scope => 'https://www.googleapis.com/auth/plus.me', :redirect_uri => @redirect_uri }
options = defaults.merge(options)
@oauth_client.auth_code.authorize_url(options)
end
# Retrieve an OAuth access token using the short-lived authentication code given to you after a user authorizes your application.
+ # Note that if you specified an over-ride redirect_uri when you called #authorize_url, you must use the same redirect_uri when calling #get_token.
#
# @param [String] auth_code The code returned to your redirect_uri after the user authorized your application to access their Google+ data.
# @param [Hash] params Additional parameters for the token endpoint (passed through to OAuth2::Client#get_token)
# @param [Hash] opts Additional access token options (passed through to OAuth2::Client#get_token)
# @return [OAuth2::AccessToken] An OAuth access token. Store access_token[:token], access_token[:refresh_token] and access_token[:expires_at] to get persistent access to the user's data until access_token[:expires_at].