Add support for Apple API sessions from Fastlane Spaceship by adamprice · Pull Request #257 · XcodesOrg/xcodes

As I use fastlane and xcodes, I thought it could be cool if xcodes could use the same Apple API auth session as fastlane to avoid having to authenticate twice.

I've added two new command line options:

--use-fastlane-auth # enable/disable feature, default off
--fastlane-user # fastlane spaceship user, uses FASTLANE_SESSION env var if none provided

With this mode enabled, cookies are copied from either the FASTLANE_SESSION environment variable or ~/.fastlane/spaceship/<user>/cookie file into an ephemeral URLSessionConfiguration that's then used for creating a URLSession to send requests. It also works with the way cookies are copied into the request for aria2. Hopefully this should stop the cookies from conficting with any existing sessions present in xcodes and they wont persist after the application has exited.

The current implementation is obviously coupled with how fastlane handles its cookies. As there's also a fastlane action for xcodes (https://docs.fastlane.tools/actions/xcodes/), another option could be coming up with a tool agnostic format for the cookies that the fastlane action can provide to xcodes.