Skip to content

Commit

Permalink
Fix Rubocop failures
Browse files Browse the repository at this point in the history
  • Loading branch information
bajajneha27 committed Jan 30, 2024
1 parent 1a6d9e3 commit c5e9537
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions lib/googleauth/user_authorizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class UserAuthorizer
# Random string of 43-128 chars used to verify the key exchange using
# PKCE. Auto-generated if not provided
def initialize client_id, scope, token_store,
callback_uri = nil, code_verifier = nil
callback_uri = nil, code_verifier = nil
raise NIL_CLIENT_ID_ERROR if client_id.nil?
raise NIL_SCOPE_ERROR if scope.nil?

Expand Down Expand Up @@ -94,12 +94,12 @@ def get_authorization_url options = {}
scope = options[:scope] || @scope

options[:additional_parameters] ||= {}

if @code_verifier
options[:additional_parameters].merge!(
{
{
code_challenge: generate_code_challenge(@code_verifier),
code_challenge_method: get_code_challenge_method
code_challenge_method: code_challenge_method
}
)
end
Expand Down Expand Up @@ -176,7 +176,7 @@ def get_credentials_from_code options = {}
scope = options[:scope] || @scope
base_url = options[:base_url]
options[:additional_parameters] ||= {}
options[:additional_parameters].merge!({"code_verifier": @code_verifier})
options[:additional_parameters].merge!({ code_verifier: @code_verifier })
credentials = UserRefreshCredentials.new(
client_id: @client_id.id,
client_secret: @client_id.secret,
Expand Down Expand Up @@ -262,8 +262,7 @@ def code_verifier= new_code_verifier
# authorization URL.
def generate_code_verifier
random_number = rand 32..96
res = SecureRandom.alphanumeric(random_number).to_str
res
SecureRandom.alphanumeric(random_number).to_str
end

private
Expand Down Expand Up @@ -316,7 +315,7 @@ def generate_code_challenge code_verifier
Base64.urlsafe_encode64 digest, padding: false
end

def get_code_challenge_method
def code_challenge_method
"S256"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/googleauth/web_user_authorizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def self.handle_auth_callback_deferred request
# Random string of 43-128 chars used to verify the key exchange using
# PKCE. Auto-generated if not provided.
def initialize client_id, scope, token_store,
callback_uri = nil, code_verifier = nil
callback_uri = nil, code_verifier = nil
super client_id, scope, token_store, callback_uri, code_verifier
end

Expand Down

0 comments on commit c5e9537

Please sign in to comment.