Search code examples
continuous-integrationgitlabgitlab-cifastlane

Fastlane doesn't work for Apple id with two factor authentication on continuous integration working with Gitlab


My appleid has two factor authentication turned on. For continuous integration we use Fastlane tool.

Available session is not valid any more. Continuing with normal login.
Two-factor Authentication (6 digits code) is enabled for account '[email protected]'

What can I do to fix that?


Solution

    1. On yout machine when CI is running, go to the terminal and type the following command:

      fastlane spaceauth -u [email protected]
      
    2. Then fastlane will ask you about the code: Please enter 6 digits code:. Get it from another trusted device and type it here.

    3. You will receive FASTLANE_SESSION key. Just copy and paste it.
    4. Login to your gitlab account that is used along with your CI and go to Settings > CI/CD > Variables. Then define FASTLANE_SESSION variable, type the value and save.
    5. Run your job again.