fix: Arity of WebUserAuthorizer#get_credentials should be compatible with base class

This commit is contained in:
Daniel Azuma 2019-07-26 08:19:06 -07:00 committed by GitHub
parent b9531ea662
commit c5e5f55bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -14,3 +14,5 @@ Metrics/ModuleLength:
Metrics/BlockLength:
Exclude:
- "googleauth.gemspec"
Style/SafeNavigation:
Enabled: false

View File

@ -176,12 +176,13 @@ module Google
super options
end
# Fetch stored credentials for the user.
# Fetch stored credentials for the user from the given request session.
#
# @param [String] user_id
# Unique ID of the user for loading/storing credentials.
# @param [Rack::Request] request
# Current request
# Current request. Optional. If omitted, this will attempt to fall back
# on the base class behavior of reading from the token store.
# @param [Array<String>, String] scope
# If specified, only returns credentials that have all the \
# requested scopes
@ -190,8 +191,8 @@ module Google
# @raise [Signet::AuthorizationError]
# May raise an error if an authorization code is present in the session
# and exchange of the code fails
def get_credentials user_id, request, scope = nil
if request.session.key? CALLBACK_STATE_KEY
def get_credentials user_id, request = nil, scope = nil
if request && request.session.key?(CALLBACK_STATE_KEY)
# Note - in theory, no need to check required scope as this is
# expected to be called immediately after a return from authorization
state_json = request.session.delete CALLBACK_STATE_KEY