Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastlane finish with error "The request could not be completed because: Unauthorized Access" in iOS

I'm new in Fastlane and install it throw the official document. Now I want to create an app using Fastlane and try to run the basic command "bundle exec fastlane create_app" where "create_app" is a lane created in my Fastfile in my project directory. After that, it is giving me the error: "Unauthorized Access"

I didn't understand why this is happening? I'm giving the output log below.

***@iOS-MAC-15 TryFastlane % bundle exec fastlane create_app
[āœ”] šŸš€ 
[10:27:24]: ------------------------------
[10:27:24]: --- Step: default_platform ---
[10:27:24]: ------------------------------
[10:27:24]: Driving the lane 'ios create_app' šŸš€
[10:27:24]: ---------------------
[10:27:24]: --- Step: produce ---
[10:27:24]: ---------------------
+----------------+--------------------------------+
|           Summary for produce 2.137.0           |
+----------------+--------------------------------+
| username       | ***                            |
| app_identifier | com.***.***                    |
| sku            | 1576643244                     |
| platform       | ios                            |
| language       | English                        |
| skip_itc       | false                          |
| skip_devcenter | false                          |
+----------------+--------------------------------+
Two-factor Authentication (6 digits code) is enabled for account '***'
More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915
If you're running this in a non-interactive session (e.g. server or CI)
check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification
Environment variable `SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER` is set, automatically requesting 2FA token via SMS to that number
SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER = ***
Successfully requested text message to ***
Please enter the 6 digit code you received at ***:
999822
Requesting session...
+------------------+----------------+
|           Lane Context            |
+------------------+----------------+
| DEFAULT_PLATFORM | ios            |
| PLATFORM_NAME    | ios            |
| LANE_NAME        | ios create_app |
+------------------+----------------+
[10:37:21]: Unauthorized Access
+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| šŸ’„   | produce          | 597         |
+------+------------------+-------------+
[10:37:21]: fastlane finished with errors
Looking for related GitHub issues on fastlane/fastlane...
āž”ļø  The request could not be completed because: Unauthorized Access
    https://github.com/fastlane/fastlane/issues/15411 [closed] 21 šŸ’¬
    3 weeks ago
āž”ļø  Unauthorized Access when I use Fastlane pilot upload
    https://github.com/fastlane/fastlane/issues/15125 [closed] 6 šŸ’¬
    5 weeks ago
āž”ļø  The request could not be completed because:Unauthorized Access
    https://github.com/fastlane/fastlane/issues/13923 [closed] 14 šŸ’¬
    31 Jul 2019
and 15 more at: https://github.com/fastlane/fastlane/search?q=The%20request%20could%20not%20be%20completed%20because%3A%0A%09Unauthorized%20Access&type=Issues&utf8=āœ“
šŸ”—  You can āŒ˜ + double-click on links to open them directly in your browser.
[!] The request could not be completed because:
    Unauthorized Access

Appfile Details:

app_identifier "com.***.***" 
apple_id "***"

Fastfile Details:

default_platform(:ios)

platform :ios do

before_all do
    ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"] = "***"
    ENV["FASTLANE_USER"] = "***"
    ENV["FASTLANE_PASSWORD"] = "***"
  end


# 1
  desc "Create app on Apple Developer and App Store Connect sites"
# 2
  lane :create_app do
# 3
ā€‹    produce
  end
end
like image 638
Muhammad Ariful Islam Avatar asked Dec 18 '19 08:12

Muhammad Ariful Islam


1 Answers

I have solved the issue it is 2FA in CLI. First, remove the credential by fastlane fastlane-credentials remove --username appleID, Second, create apple application password on AppleID and use it as environment variable in fastlane "FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD" .finally, run the lane. The Fastfile after added that variable looks like this.

default_platform(:ios)

platform :ios do

before_all do
    ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"] = "***"
    ENV["FASTLANE_USER"] = "***"
    ENV["FASTLANE_PASSWORD"] = "***"
    ENV["FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"] = "***"
  end


# 1
  desc "Create app on Apple Developer and App Store Connect sites"
# 2
  lane :create_app do
# 3
ā€‹    produce
  end
end
like image 115
Muhammad Ariful Islam Avatar answered Oct 12 '22 20:10

Muhammad Ariful Islam