Codemagic failed to publish Error: code -22020

2.5k Views Asked by At

My build failed using Codemagic with the Error code -22020 after building the whole app.

 Successfully created archive at build/ios/xcarchive/Runner_4myti30z.xcarchive
Export build/ios/xcarchive/Runner_4myti30z.xcarchive to build/ios/ipa
Execute "xcodebuild -exportArchive -archivePath build/ios/xcarchive/Runner_4myti30z.xcarchive -exportPath build/ios/ipa -exportOptionsPlist /Users/builder/export_options.plist COMPILER_INDEX_STORE_ENABLE=NO"


▸ Export Succeeded

Successfully exported ipa to build/ios/ipa/Runner.ipa
Raw xcodebuild logs stored in /tmp/xcodebuild_logs/Runner_x1541cb8.log

Then in the publish part it drops me an error at the end

== Gathering artifacts ==


== Publishing artifacts ==

[skipped]

Publishing Runner.ipa to App Store Connect

/usr/bin/xcrun altool --validate-app -f /Users/builder/clone/build/ios/ipa/Runner.ipa -t ios -u *********@hotmail.com -p @env:APP_STORE_CONNECT_PASSWORD --output-format normal

    2020-09-01 08:48:58.794 altool[31554:179398] *** Error: Unable to validate archive '/Users/builder/clone/build/ios/ipa/Runner.ipa'.
    2020-09-01 08:48:58.794 altool[31554:179398] *** Error: code -22020 (Unable to validate your application. We are unable to create an authentication session.)



Failed to publish to App Store Connect


Build failed :|


Publishing failed :|
Failed to publish to App Store Connect
2

There are 2 best solutions below

0
On

You can find out the upload error reason by downloading the generated ipa file from Code Magic and manually uploading it to AppStoreConnect with Transporter application.

Once Transporter shows you each error, fix them and try to upload again either with Transporter or CodeMagic. It should work if the errors are fixed.

2
On

The most common reason for the occurrence of this error message is using Apple ID password instead of app-specific password in App Store Connect publishing settings.

To generate an app-specific password, sign in to your Apple ID account page, navigate to the Security section and click Generate Password… below App-Specific Passwords. The generated app-specific password will be in this format: abcd-efgh-ijkl-mnop. Insert this value into the Codemagic UI or as a password in codemagic.yaml when setting up publishing to App Store Connect.

Note that the password should be generated with the same Apple account that you are using for publishing.