Got 403 when I touch group with delete method in testflight

72 views Asked by At

After deleting group from testflight I got the url with delete method show as follow:

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'

Then I realized this process with fastlane like:

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

And I got 403 when I called this method after login, select team.

What I want to ask is that dose the itc support to this? If supports, how can fix it?

1

There are 1 answers

0
iOkay On

Yes. It supports.Just adjust the http header and it will pass.