0

从 testflight 中删除组后,我得到了带有 delete 方法的 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对此的支持吗?如果支持,如何解决?

4

1 回答 1

0

是的。它支持。只需调整http头,它就会通过。

于 2017-09-12T08:22:10.163 回答