15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'spaceship/lib/spaceship/spaceauth_runner.rb', line 15
def run
begin
puts("Logging into to App Store Connect (#{@username})...")
Spaceship::Tunes.login(@username)
puts("Successfully logged in to App Store Connect".green)
puts("")
rescue
puts("Could not login to App Store Connect".red)
puts("Please check your credentials and try again.".yellow)
puts("This could be an issue with App Store Connect,".yellow)
puts("Please try unsetting the FASTLANE_SESSION environment variable".yellow)
puts("(if it is set) and re-run `fastlane spaceauth`".yellow)
raise "Problem connecting to App Store Connect"
end
itc_cookie_content = Spaceship::Tunes.client.store_cookie
cookies = YAML.safe_load(
itc_cookie_content,
[HTTP::Cookie, Time], [], true )
cookies.select! do |cookie|
cookie.name.start_with?("myacinfo") || cookie.name == 'dqsid'
end
yaml = cookies.to_yaml.gsub("\n", "\\n")
puts("---")
puts("")
puts("Pass the following via the FASTLANE_SESSION environment variable:")
puts(yaml.cyan.underline)
puts("")
puts("")
puts("Example:")
puts("export FASTLANE_SESSION='#{yaml}'".cyan.underline)
if mac? && Spaceship::Client::UserInterface.interactive? && agree("🙄 Should fastlane copy the cookie into your clipboard, so you can easily paste it? (y/n)", true)
require 'open3'
Open3.popen3('pbcopy') { |input, _, _| input << yaml }
puts("Successfully copied text into your clipboard 🎨".green)
end
end
|