'Nativescript tns publish ios not working reliably since Apple enforced 2FA on App Store Connect

I have a Nativescript app which I want to publish to App Store Connect. I am using a CI/CD system setup as such:

  • Step 1: build the app for release using "tns build", it outputs an .ipa file
  • Step 2: run the command "tns publish ios", and uses a specific Apple ID to log in to App Store Connect and upload the .ipa file

This system used to work fine, until Apple started to make 2FA mandatory for all accounts interacting with App Store Connect in March 2021.

Since then, the command "tns publish ios" has been unable to send the binary to App Store Connect, mentioning an authentication error, and prompting me to enable 2FA on the Apple ID I used.

I've completed the following steps to make my CI/CD system work again:

  • enabled 2FA on the specific Apple ID I mentioned earlier
  • set up an application-specific password for this Apple ID which would be used by my CI/CD software
  • used the tool "tns apple-login" from a mac machine to generate a valid session token for this Apple ID
  • added the app-specific password and the session token as parameters to "tns publish ios" following this piece of documentation https://v7.docs.nativescript.org/angular/tooling/docs-cli/publishing/publish-ios

After doing this, I can successfully build and upload an iOS app build on App Store Connect using my CI/CD system... For a few hours. After this happens, I have to regenerate a new session token using "tns apple-login".

It seems the 2FA support for the "tns publish ios" command was an aftertought. I can't imagine having to log-in every time I want to upload a binary is a good long term solution.

Has anyone else had that issue with a Nativescript app ? Any good alternatives for uploading an already built .ipa file to App Store Connect, using a CI/CD system ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source