Solution
As the error message says, we need to create an app-specific password at the:
http://appleid.apple.com
address. Go to the security section and use the Generate Password.
Generate Password
Use the Generate Password link to create a new password. Copy and paste the password and don't forget you won't be able to find the password again after you click on the Done button.
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD
Then, set the FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD environment variables at your bash or your .bash_profile file. This file could be different depending on your choice for the bash on your terminal. For example, if your bash of choice is ZSH like mine, you need to edit the .zshrc file.
Then re-run your Fastlane with:
bundle exec fastlane beta --verbose
Note: When you can not enter the security code manually, as on a Continuous Integration system, you have to use other ways to log in. The application-specific password will not work if your action usage does anything else than uploading the binary, e.g. updating any metadata like setting release notes or distributing to testers, etc.
Generating a login session for Apple ID
As your CI machine will not be able to prompt you for your two-factor authentication or two-step verification information, you need to generate a login session for Apple ID in advance. You can get on your local machine this by running:
fastlane spaceauth -u user@email.com
What Else?
⚠️ If you've Apple ID without 2FA
Apple ID without 2FA is deprecated! Apple announced that as of February 27th 2019, it would enforce 2-factor authentication on developer Apple IDs with the "Account Holder" role. Since then, they extended this rule to all roles, and then later throughout 2020 they slowly enforced all existing accounts to register 2FA. As of March 3rd, 2021, no accounts without 2FA registered are able to login until they register a 2FA method, essentially breaking all "non-2FA compliant Apple IDs" that still existed. For this reason, when using fastlane in your CI, you will have to work your way with 2FA.
for more, please check the fastlane documentation .
Hope this helps!