Skip to content

Commit

Permalink
Update http_client.rb to fix detect_provider problem (#469)
Browse files Browse the repository at this point in the history
* Update http_client.rb to fix detect_provider problem

Detect Provider calls build_query method from Auth.rb instead of http_client.rb. By renaming the private method build_query to build_http_query on http_client.rb the problem is solved.

* Add build_http_query to spec

* Renamed build_query on Auth instead of http_client
  • Loading branch information
atejada committed Mar 1, 2024
1 parent 67a0b38 commit d97a9a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/nylas/resources/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def detect_provider(params)
# @return [String] Updated list of parameters, including those specific to admin
# consent.
def build_query_with_admin_consent(config)
params = build_query(config)
params = build_http_query(config)

# Appends new params specific for admin consent.
params[:provider] = "microsoft"
Expand All @@ -135,7 +135,7 @@ def build_query_with_admin_consent(config)
# @return [String] Updated list of encoded parameters, including those specific
# to PKCE.
def build_query_with_pkce(config, secret_hash)
params = build_query(config)
params = build_http_query(config)

# Appends new PKCE specific params.
params[:code_challenge_method] = "s256"
Expand All @@ -151,7 +151,7 @@ def build_query_with_pkce(config, secret_hash)
def url_auth_builder(config)
builder = URI.parse(api_uri)
builder.path = "/v3/connect/auth"
builder.query = URI.encode_www_form(build_query(config)).gsub(/\+/, "%20")
builder.query = URI.encode_www_form(build_http_query(config)).gsub(/\+/, "%20")

builder
end
Expand All @@ -160,7 +160,7 @@ def url_auth_builder(config)
#
# @param config [Hash] Configuration for the query.
# @return [Hash] List of parameters to encode in the query.
def build_query(config)
def build_http_query(config)
params = {
client_id: config[:client_id],
redirect_uri: config[:redirect_uri],
Expand Down

0 comments on commit d97a9a5

Please sign in to comment.