当我在testflight中使用delete方法触摸组时得到403

时间:2017-09-11 05:51:59

标签: testflight fastlane fastlane-pilot

从testflight删除组后,我得到了删除方法显示的url如下:

curl 'https://itunesconnect.apple.com/testflight/v2/providers/team_id/apps/app_id/groups/969071cb-0615-4dac-8b1a-166fd7e89a98?deleteTesters=false' \
-XDELETE \
-H 'DNT: 1' \
-H 'Referer: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/app_id/testflight?section=iosbuilds' \
-H 'Origin: https://itunesconnect.apple.com' \
-H 'Accept: application/json, text/plain, */*' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8' \
-H 'X-Csrf-Itc: itc'

然后我用fastlane实现了这个过程:

module Spaceship
  module TestFlight
    module GroupOperations

      ## TODO: Got 403 error
      def delete_group_for_app(apple_id, group_id, delete_testers)
        assert_required_params(__method__, binding)

        binding.pry
        url = "providers/#{team_id}/apps/#{apple_id}/groups/#{group_id}?deleteTesters=#{delete_testers.to_s}"
        refer = "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{apple_id}/testflight?section=group&subsection=testers&id=#{group_id}"

        response = request(:delete) do |req|
          req.url url
          req.headers['Content-Type'] = 'application/json'
          req.headers['Referer'] = refer
          req.headers['Origin'] = 'https://itunesconnect.apple.com'
          req.headers['X-Requested-With'] = 'XMLHttpRequest'
          req.headers['X-Csrf-Itc'] = 'itc'
          req.headers['Accept'] = 'application/json, text/plain, */*'
          req.headers['Connection'] = 'keep-alive'
        end
        handle_response(response)
      end
    end

    Client.class_eval { include GroupOperations }
    class Client
      include GroupOperations
    end
  end
end

当我在登录后调用此方法时,我得到403,选择团队。

我想问的是itc支持itc吗?如果支持,如何解决?

1 个答案:

答案 0 :(得分:0)

是。它支持。只需调整http标头即可通过。