Skip to content

Commit

Permalink
Merge pull request #803 from sul-dlss/corylown-patch-1
Browse files Browse the repository at this point in the history
Post Aspace password as form data
  • Loading branch information
marlo-longley authored Sep 20, 2024
2 parents 8e2d5f2 + 2a14e5f commit 9f0529e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/services/aspace_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def send_request(method, path, body = nil)
# https://archivesspace.github.io/archivesspace/api/#log-in
def session_token
@session_token ||= begin
uri = URI.parse("#{@base_url}/users/#{@user}/login?password=#{@password}")
res = Net::HTTP.post_form(uri, {})
uri = URI.parse("#{@base_url}/users/#{@user}/login")
res = Net::HTTP.post_form(uri, { password: @password })
raise StandardError, "Unexpected response code #{res.code}: #{res.read_body}" unless res.is_a?(Net::HTTPOK)

JSON.parse(res.body)['session']
Expand Down
2 changes: 1 addition & 1 deletion spec/services/aspace_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
before do
# Authentication request
stub_request(:post,
"#{url}/users/#{user}/login?password=#{password}").to_return(body: { session: 'token1' }.to_json)
"#{url}/users/#{user}/login").to_return(body: { session: 'token1' }.to_json)
end

describe '#initialize' do
Expand Down

0 comments on commit 9f0529e

Please sign in to comment.