flutterapp-store-connectfastlaneipafastlane-pilot

Fastlane : [altool] Error: Unable to upload archive. Failed to get authorization for username and password


I try to upload my flutter ipa to the AppStore with fastlane using pilot with the following command:

bundle exec fastlane pilot upload --ipa ../build/ios/ipa/project.ipa

When I run this command I face the following error

I have a .p8 in the private_keys folder

It seems that pilot can log me with my apple ID but just after it throws me that it failed to get authorization.

After it failed, when I go to TestFlight I can see my new version available but with the old version name (e.g. 1.0.0 instead of 1.0.1)

[monsieur_x | ~/project/ios ]$ bundle exec fastlane pilot upload --ipa ../build/ios/ipa/project.ipa
[āœ”] šŸš€ 
[17:54:31]: Login to App Store Connect (apple_id@gmail.com)
[17:54:33]: Login successful
[17:54:35]: Ready to upload new build to TestFlight (App: 1544671867)...
[17:54:39]: Going to upload updated app to App Store Connect
[17:54:39]: This might take a few minutes. Please don't interrupt the script.
[17:54:41]: [altool] 2022-10-26 17:54:41.294 *** Error: Unable to upload archive. Failed to get authorization for username 'apple_id@gmail.com' and password. (

[17:54:41]: [altool]     "Error Domain=NSCocoaErrorDomain Code=0 \"Status code: 0\" UserInfo={NSLocalizedDescription=Status code: 0, NSLocalizedFailureReason=The auth server returned a bad status code.}"

[17:54:41]: [altool] ) (-1011)

[17:54:41]: [altool]  {

[17:54:41]: [altool]     NSLocalizedDescription = "Unable to upload archive.";

[17:54:41]: [altool]     NSLocalizedFailureReason = "Failed to get authorization for username 'apple_id@gmail.com' and password. (\n    \"Error Domain=NSCocoaErrorDomain Code=0 \\\"Status code: 0\\\" UserInfo={NSLocalizedDescription=Status code: 0, NSLocalizedFailureReason=The auth server returned a bad status code.}\"\n)";

[17:54:41]: [altool] }

[17:54:41]: Application Loader output above ^
[17:54:41]: Error uploading '/var/folders/gr/z1j06nhs2sd38gwv4_l51rj40000gn/T/7d36fd34-357d-4c08-aa9d-7db6ed3a8b82.ipa'.
[17:54:41]: Unable to upload archive. Failed to get authorization for username 'apple_id@gmail.com' and password. (
[17:54:41]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.
[17:54:41]: Could not download/upload from App Store Connect!

[!] Error uploading ipa file: 
 [Application Loader Error Output]: Error uploading '/var/folders/gr/z1j06nhs2sd38gwv4_l51rj40000gn/T/7d36fd34-357d-4c08-aa9d-7db6ed3a8b82.ipa'.
[Application Loader Error Output]: Unable to upload archive. Failed to get authorization for username 'apple_id@gmail.com' and password. (
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.

Here is my fastlane env if you need:

<details><summary>šŸš« fastlane environment šŸš«</summary>

### Stack

| Key                         | Value                                                          |
| --------------------------- | -------------------------------------------------------------- |
| OS                          | 12.6                                                           |
| Ruby                        | 2.6.8                                                          |
| Bundler?                    | false                                                          |
| Git                         | git version 2.38.0                                             |
| Installation Source         | /usr/local/bin/fastlane                                        |
| Host                        | macOS 12.6 (21G115)                                            |
| Ruby Lib Dir                | /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib |
| OpenSSL Version             | LibreSSL 2.8.3                                                 |
| Is contained                | false                                                          |
| Is homebrew                 | false                                                          |
| Is installed via Fabric.app | false                                                          |
| Xcode Path                  | /Applications/Xcode.app/Contents/Developer/                    |
| Xcode Version               | 14.0.1                                                         |
| Swift Version               | 5.7                                                            |


### System Locale

| Error                       |
| --------------------------- |
| No Locale with UTF8 found šŸš« |


### fastlane files:

<details><summary>`./fastlane/Fastfile`</summary>
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :beta do
    increment_build_number(xcodeproj: "Runner.xcodeproj")
    build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
    upload_to_testflight
  end
end

`./fastlane/Appfile`
app_identifier("com.balanz") # The bundle identifier of your app
apple_id("contact@balanz.fr") # Your Apple Developer Portal username

itc_team_id("122453945") # App Store Connect Team ID
team_id("T3P8853DAC") # Developer Portal Team ID

# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.210.1 āœ… Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.3.0
atomos 0.1.3
colored2 3.1.2
nanaimo 0.3.0
rexml 3.2.5
xcodeproj 1.21.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
unicode-display_width 1.8.0
terminal-table 1.8.0
plist 3.6.0
public_suffix 4.0.6
addressable 2.8.0
multipart-post 2.0.0
word_wrap 1.0.0
optparse 0.1.1
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
artifactory 3.0.15
babosa 1.0.4
colored 1.2
highline 2.0.3
commander 4.6.0
excon 0.92.2
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
faraday-multipart 1.0.3
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
faraday-retry 1.0.3
ruby2_keywords 0.0.5
faraday 1.10.0
unf_ext 0.0.8.1
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.4
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.6
gh_inspector 1.1.3
mini_magick 4.11.0
naturally 2.2.1
rubyzip 2.3.2
security 0.1.3
xcpretty-travis-formatter 1.0.1
dotenv 2.7.6
bundler 2.3.10
simctl 1.6.8
jwt 2.3.0
uber 0.1.0
declarative 0.0.20
trailblazer-option 0.1.2
representable 3.1.1
retriable 3.1.2
mini_mime 1.1.2
memoist 0.16.2
multi_json 1.15.0
os 1.1.4
signet 0.16.1
googleauth 1.1.2
httpclient 2.8.3
google-apis-core 0.4.2
google-apis-playcustomapp_v1 0.7.0
google-apis-androidpublisher_v3 0.17.0
google-cloud-env 1.6.0
google-cloud-errors 1.2.0
google-cloud-core 1.6.0
google-apis-iamcredentials_v1 0.10.0
google-apis-storage_v1 0.11.0
digest-crc 0.6.4
google-cloud-storage 1.36.1
emoji_regex 3.2.3
jmespath 1.6.1
aws-partitions 1.572.0
aws-eventstream 1.2.0
aws-sigv4 1.4.0
aws-sdk-core 3.130.0
aws-sdk-kms 1.55.0
aws-sdk-s3 1.113.0
CFPropertyList 3.0.5
claide 1.1.0
json 2.6.1
webrick 1.7.0
rake 13.0.6
forwardable 1.2.0
logger 1.3.0
date 2.0.0
stringio 0.0.2
ipaddr 1.2.2
openssl 2.1.2
zlib 1.0.0
mutex_m 0.1.0
ostruct 0.1.0
strscan 1.0.0
io-console 0.4.7
fileutils 1.1.0
etc 1.0.1
libxml-ruby 3.2.1
psych 3.1.0

generated on: 2022-10-27

Does someone have an idea ?

Thank you !


Solution

  • Hello I was struggling with this issue for many days.

    Solution

    Step 1

    Go to https://appleid.apple.com/account/manage login in and go to App-Specific Passwords, after generate a new App Specific Password copy it.

    Step2

    Inside fastlane folder create a new file .env.default and add the two properties .

    FASTLANE_USER=<Apple USER ID>
    FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=<App-Specific Password>
    

    Use an app-specific password to sign in to an app or service not provided by Apple such as fastlane.

    ------------------------------Other options--------------------------------

    You have different options not only using .env file.

    1- In your Fastfile

    FASTLANE_USER=<Apple USER ID>
    FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=<App-Specific Password>
    
    lane :beta do
      crashlytics
    end
    

    2- Bash Profile

    nano ~/.bash_profile
    

    insert your properties

    FASTLANE_USER=<Apple USER ID>
    FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=<App-SpecificPassword>
    

    CTRL + X - save changes. reopen your terminal

    Please in check the link for more details about. https://docs.fastlane.tools/best-practices/keys/