lib/spaceship/two_step_client.rb in spaceship-0.26.1 vs lib/spaceship/two_step_client.rb in spaceship-0.26.2
- old
+ new
@@ -1,15 +1,15 @@
module Spaceship
class Client
def handle_two_step(response)
- @x_apple_web_session_token = response["x-apple-web-session-token"]
+ @x_apple_id_session_id = response["x-apple-id-session-id"]
@scnt = response["scnt"]
r = request(:get) do |req|
req.url "https://idmsa.apple.com/appleauth/auth"
req.headers["scnt"] = @scnt
- req.headers["X-Apple-Web-Session-Token"] = @x_apple_web_session_token
+ req.headers["X-Apple-Id-Session-Id"] = @x_apple_id_session_id
req.headers["Accept"] = "application/json"
end
if r.body.kind_of?(Hash) && r.body["trustedDevices"].kind_of?(Array)
if r.body.fetch("securityCode", {})["tooManyCodesLock"].to_s.length > 0
@@ -74,11 +74,11 @@
# Request Token
r = request(:put) do |req|
req.url "https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode"
req.headers["Accept"] = "application/json"
req.headers["scnt"] = @scnt
- req.headers["X-Apple-Web-Session-Token"] = @x_apple_web_session_token
+ req.headers["X-Apple-Id-Session-Id"] = @x_apple_id_session_id
end
# we use `Spaceship::TunesClient.new.handle_itc_response`
# since this might be from the Dev Portal, but for 2 step
Spaceship::TunesClient.new.handle_itc_response(r.body)
@@ -90,11 +90,11 @@
# Send token back to server to get a valid session
r = request(:post) do |req|
req.url "https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode"
req.headers["Accept"] = "application/json"
req.headers["scnt"] = @scnt
- req.headers["X-Apple-Web-Session-Token"] = @x_apple_web_session_token
+ req.headers["X-Apple-Id-Session-Id"] = @x_apple_id_session_id
req.body = { "code" => code.to_s }.to_json
req.headers['Content-Type'] = 'application/json'
end
begin
@@ -139,10 +139,10 @@
# We actually only care about the DES value
request(:get) do |req|
req.url "https://idmsa.apple.com/appleauth/auth/2sv/trust"
req.headers["scnt"] = @scnt
- req.headers["X-Apple-Web-Session-Token"] = @x_apple_web_session_token
+ req.headers["X-Apple-Id-Session-Id"] = @x_apple_id_session_id
end
# This request will fail if the user isn't added to a team on iTC
# However we don't really care, this request will still return the
# correct DES... cookie