Skip to content

Commit

Permalink
fix oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-descope committed Feb 6, 2024
1 parent 68085de commit 6ac2a4e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/descope/mixins/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ def request_with_retry(method, uri, body = {}, extra_headers = {}, pswd = nil)

def request(method, uri, body = {}, extra_headers = {})
# @headers is getting the authorization header merged in initializer.rb
headers_debug = @headers.dup
if headers_debug['Authorization']
headers_debug['Authorization'] = headers_debug['Authorization'].gsub(/(.{10})\z/, '***********')
end

@logger.debug "base url: #{@base_uri}"
@logger.debug "request method: #{method}, uri: #{uri}, body: #{body}, extra_headers: #{extra_headers}, headers: #{@headers}"
@logger.debug "request method: #{method}, uri: #{uri}, body: #{body}, extra_headers: #{extra_headers}, headers: #{headers_debug}"
result = case method
when :get
get_headers = @headers.merge({ params: body }).merge(extra_headers)
Expand Down
1 change: 0 additions & 1 deletion lib/descope/mixins/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def base_url(options)
def authorization_header(pswd = nil)
pswd = @default_pswd if pswd.nil? || pswd.empty?
bearer = "#{@project_id}:#{pswd}"
@logger.debug("setting bearer header #{bearer}")
add_headers('Authorization' => "Bearer #{bearer}")
end

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/lib.descope/api/v1/auth/oauth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Handle Confirmation page
begin
puts "Confirmation page found"
@driver.find_element(:name, 'authorize').click
@driver.find_element(:id, 'js-oauth-authorize-btn').click
rescue Selenium::WebDriver::Error::NoSuchElementError
puts 'could not find confirmation button'
# Handle case where confirmation page isn't present
Expand Down

0 comments on commit 6ac2a4e

Please sign in to comment.