fastlane: Spaceauth fails with "Verification codes can’t be sent to this phone number at this time. Please try again later."
New Issue Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Issue Description
I am attempting to invoke the produce action to create a new app in the developer portal and AppStoreConnect. Because produce does not currently support ASC API keys, I am attempting to manually verify my local machine using spaceauth. This approach worked for me about 6 months ago when I last ran produce to create a new app in my account.
However, running spaceauth fails when attempting to send the 2FA code to my phone number. It spits out the following error:
[!] The request could not be completed because: {“code”=>“-28248”, “title”=>“Verification Failed”, “message”=>“Verification codes can’t be sent to this phone number at this time. Please try again later.”, “suppressDismissal”=>false}
Command executed
bundle exec fastlane spaceauth -u "myappleid@appleid.com"
Complete output when running fastlane, including the stack trace and command used
bundle exec fastlane spaceauth -u "myappleid@appleid.com"[✔] 🚀 Logging into to App Store Connect (myappleid@appleid.com)… Two-factor Authentication (6 digits code) is enabled for account ‘myappleid@appleid.com’ 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
Please select a trusted phone number to send code to:
- +1 (•••) •••-••••
- +1 (•••) •••-•••• ? 1 Could not login to App Store Connect Please check your credentials and try again. This could be an issue with App Store Connect, Please try unsetting the FASTLANE_SESSION environment variable by calling ‘unset FASTLANE_SESSION’ (if it is set) and re-run
fastlane spaceauthException type: Spaceship::Tunes::Error
Looking for related GitHub issues on fastlane/fastlane…
➡️ Verification codes can’t be sent to this phone number at this time. Please try again later https://github.com/fastlane/fastlane/issues/21993 [closed] 17 💬 41 minutes ago
🔗 You can ⌘ + double-click on links to open them directly in your browser.
[!] The request could not be completed because: {“code”=>“-28248”, “title”=>“Verification Failed”, “message”=>“Verification codes can’t be sent to this phone number at this time. Please try again later.”, “suppressDismissal”=>false}
Environment
✅ fastlane environment ✅
Stack
Key Value OS 15.1.1 Ruby 3.1.1 Bundler? true Git git version 2.39.5 (Apple Git-154) Installation Source ~/.rbenv/versions/3.1.1/bin/fastlane Host macOS 15.1.1 (24B91) Ruby Lib Dir ~/.rbenv/versions/3.1.1/lib OpenSSL Version OpenSSL 1.1.1l 24 Aug 2021 Is contained false Is homebrew false Is installed via Fabric.app false Xcode Path /Applications/Xcode-16.1.app/Contents/Developer/ Xcode Version 16.1 Swift Version 6.0.2 System Locale
Variable Value LANG en_US.UTF-8 ✅ LC_ALL LANGUAGE fastlane gems
| Gem | Version | Update-Status |
|---|---|---|
| fastlane | 2.225.0 | ✅ Up-To-Date |
Loaded fastlane plugins:
| Plugin | Version | Update-Status |
|---|---|---|
| fastlane-plugin-changelog | 0.16.0 | ✅ Up-To-Date |
| fastlane-plugin-badge | 1.5.0 | ✅ Up-To-Date |
Loaded gems
| Gem | Version |
|---|---|
| error_highlight | 0.5.1 |
| did_you_mean | 1.6.3 |
| bundler | 2.4.22 |
| pathname | 0.3.0 |
| rake | 13.2.1 |
| base64 | 0.2.0 |
| nkf | 0.2.0 |
| rexml | 3.3.9 |
| CFPropertyList | 3.0.7 |
| benchmark | 0.3.0 |
| bigdecimal | 3.1.8 |
| concurrent-ruby | 1.3.4 |
| connection_pool | 2.4.1 |
| drb | 2.2.1 |
| i18n | 1.14.6 |
| logger | 1.6.1 |
| minitest | 5.25.1 |
| securerandom | 0.3.1 |
| tzinfo | 2.0.6 |
| activesupport | 7.2.2 |
| public_suffix | 6.0.1 |
| addressable | 2.8.7 |
| artifactory | 3.0.17 |
| atomos | 0.1.3 |
| aws-eventstream | 1.3.0 |
| aws-partitions | 1.1001.0 |
| aws-sigv4 | 1.10.1 |
| jmespath | 1.6.2 |
| aws-sdk-core | 3.211.0 |
| aws-sdk-kms | 1.95.0 |
| aws-sdk-s3 | 1.169.0 |
| babosa | 1.0.4 |
| fastimage | 2.3.1 |
| colored | 1.2 |
| highline | 2.0.3 |
| commander | 4.6.0 |
| dotenv | 2.8.1 |
| emoji_regex | 3.2.3 |
| excon | 0.112.0 |
| faraday-em_http | 1.0.0 |
| faraday-em_synchrony | 1.0.0 |
| faraday-excon | 1.1.0 |
| faraday-httpclient | 1.0.1 |
| multipart-post | 2.4.1 |
| faraday-multipart | 1.0.4 |
| faraday-net_http | 1.0.2 |
| faraday-net_http_persistent | 1.2.0 |
| faraday-patron | 1.0.0 |
| faraday-rack | 1.0.0 |
| faraday-retry | 1.0.3 |
| ruby2_keywords | 0.0.5 |
| faraday | 1.10.4 |
| domain_name | 0.6.20240107 |
| http-cookie | 1.0.7 |
| faraday-cookie_jar | 0.0.7 |
| faraday_middleware | 1.2.1 |
| sysrandom | 1.0.5 |
| fastlane-sirp | 1.0.0 |
| gh_inspector | 1.1.3 |
| jwt | 2.9.3 |
| multi_json | 1.15.0 |
| os | 1.1.4 |
| signet | 0.19.0 |
| googleauth | 1.8.1 |
| httpclient | 2.8.3 |
| mini_mime | 1.1.5 |
| declarative | 0.0.20 |
| trailblazer-option | 0.1.2 |
| uber | 0.1.0 |
| representable | 3.2.0 |
| retriable | 3.1.2 |
| google-apis-core | 0.11.3 |
| google-apis-androidpublisher_v3 | 0.54.0 |
| google-apis-playcustomapp_v1 | 0.13.0 |
| google-cloud-env | 1.6.0 |
| digest-crc | 0.6.5 |
| google-apis-iamcredentials_v1 | 0.17.0 |
| google-apis-storage_v1 | 0.31.0 |
| google-cloud-errors | 1.4.0 |
| google-cloud-core | 1.7.1 |
| google-cloud-storage | 1.47.0 |
| json | 2.7.6 |
| mini_magick | 4.13.2 |
| naturally | 2.2.1 |
| optparse | 0.5.0 |
| plist | 3.7.1 |
| rubyzip | 2.3.2 |
| security | 0.1.5 |
| simctl | 1.6.10 |
| terminal-notifier | 2.0.0 |
| unicode-display_width | 2.6.0 |
| terminal-table | 3.0.2 |
| tty-screen | 0.8.2 |
| tty-cursor | 0.7.1 |
| tty-spinner | 0.9.3 |
| word_wrap | 1.0.0 |
| claide | 1.0.3 |
| colored2 | 3.1.2 |
| nanaimo | 0.4.0 |
| xcodeproj | 1.26.0 |
| rouge | 2.0.7 |
| xcpretty | 0.3.0 |
| xcpretty-travis-formatter | 1.0.1 |
| badge | 0.13.0 |
| clamp | 1.3.2 |
| fastlane-plugin-badge | 1.5.0 |
| fastlane-plugin-changelog | 0.16.0 |
| mini_portile2 | 2.8.7 |
| racc | 1.8.1 |
| nokogiri | 1.16.7 |
| slather | 2.8.4 |
| xcode-install | 2.6.8 |
generated on: 2024-12-05
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 16
- Comments: 49 (2 by maintainers)
I just solved this issue 😭 In my case, the error detail contains
"noTrustedDevices" => true. If you have the same issue, here is what I did:It allow you receive code on your Mac instead of your phone number.
THIS ONE WORKS!
I don’t know if this will be helpful to anyone encountering this issue or not. But, I wanted to throw it out there in the case that it is. A few months back my team started experiencing this. When it started it appeared to be intermittent. Sometimes we couldn’t get the verification code with the error:
As time went on this error became permanent and we were unable to refresh session cookies via the SMS phone number option. As a work around we did perform the above:
This allowed us to receive the verification via Mac. But, it was cumbersome and didn’t really work with our automated process. Today, I reached out to Apple and had them look over my account. They were not very vocal on what all they saw or the issue. But, they did say my number needed to be added to an allow list (it was already under trusted phone numbers). The support rep added my number and had me rerun Fastlane. After the rerun it started working again. Due to some skepticism I wanted to try multiple times and with multiple members on the team. Thus far it is working as expected again for us.
Apple has changed the process on their side. They have blocked all phone numbers for all 14 of my iOS accounts when using Fastlane. Logging into the portal as normal works fine. You can build your Fastlane cookies by hand by going to all 2 web pages “idmsa.apple.com, appstoreconnect.apple.com” and refreshing them, but it will only be good for 30 minutes as dqsid cookie was changed from 30 days to 30 minutes. Using the spaceauth command is going to prove very difficult. We had to switch our process to the App Store Connect API key, but that required us to rewrite all of our Ruby scripts and in no way supports push notifications. You cannot create or view anything with Push Certs. I hope Fastlane provides an update to resolve this Apple issue, but even if they do I think Apple is done with this version of Auth and is going to fight it. Note that Apple did make a change to their backend process again back in late Oct. I think they have been planing this for a while. Hit me up directly if you need some temporarly work arounds.
For all those looking for an emergency work around.
When you use Spaceauth to get your 2FA it generates this text.
‘—\n- !ruby/object:HTTP::Cookie\n name: myacinfo\n value: DAWTKNV3\n domain: apple.com\n for_domain: true\n path: “/”\n secure: true\n httponly: true\n expires:\n max_age:\n created_at: 2024-10-30 14:48:33.618229000 -04:00\n accessed_at: 2024-10-30 14:48:33.623605000 -04:00\n- !ruby/object:HTTP::Cookie\n name: DES5ff962cf2f2890a9eec8ede27c03c67fb\n value: HSARMTKNSRVXWFla3/d\n domain: idmsa.apple.com\n for_domain: true\n path: “/”\n secure: true\n httponly: true\n expires:\n max_age: 2592000\n created_at: &1 2024-10-30 14:48:33.618063000 -04:00\n accessed_at: *1\n- !ruby/object:HTTP::Cookie\n name: dqsid\n value: eyJ0eXAiOiJKV1Q\n domain: appstoreconnect.apple.com\n for_domain: false\n path: “/”\n secure: true\n httponly: true\n expires:\n max_age: 1800\n created_at: &2 2024-10-30 14:48:34.267396000 -04:00\n accessed_at: *2\n’
You use this for all your automation systems.
Well you can go into your Chrome Browser, log into apple at appstoreconnect.apple.com and then inspect your cookies. You will find these 3 keys and you can build this by hand. If done correctly your tokens will last 30 minute. The key for the idmsa.apple.com will require you to go to that website and stop the page before it redirects you. The cookie name on that one might change, grab the one that expires in 1 month, starts with DES5 and the value starts with HSAR.
I removed most of the data from my keys up top but it should give you a pretty decent idea of what you need to do.
Hi @andrewdieken! It’s been a couple months now so its a little rusty to me. But, what I remember is calling the Apple customer support number
1 (800) 275-2273and talking to a support representative. We did lose connection and I received a callback from another Apple customer support representative in Austin, TX (1 (512)-884-5022).I did explain to them that we use Fastlane and that it uses 2FA. We enter our phone number and receive a code then enter the code for verification purposes. I checked and the phone number we are using was added to the Trusted Devices in the apple account. It was working then it suddenly seemed intermittently failing and then we got to the permanent hurdle it just stopped working completely.
I talked to a few reps during the time the first one I lost connection with seemed really familiar and was helping until we lost connection. The second one was less helpful and confused. I ended up calling back again and the last one was helpful. Even though I asked they would not really explain it to me. But, they said my phone number needed to be added to the allow list whatever that means. I asked how did this happen or is there something I needed to do moving forward. They said every new number I need to call in and have them add it to the allow list even though I have already added it to the trusted devices list on my end. The other trick is they will only add one number per phone call.
Since this appears to be an issue on Apple’s end, there’s little to nothing that fastlane can do to resolve this, and there are at least 2 workarounds suggested in this thread, I think we can close this issue.
An update for our use case:
We are making the painful transition of (1) asking each customer to securely provide us with an ASC api key, key id, and issuer id, and (2) using the new auth mechanism.
Thanks for making 2025 difficult Apple 🙄
+1 Although is anybody using a service provider phone number and facing the same issue? (Azure or any other cloud SP)
Update: We have an an infrastructure that automatically retries 1 time every 12 hours. So after continuous failure for 2 tweeks it itself passed 3 times in a row.
Also I have a theory: Looks like Fastlane - Apple doesn’t want this setup to be an automatic one but manual only, so it might learn such pattern :
So PS: They might be freezing accounts for some time period and then resuming services again. Perhaps a ticket with Apple might give us some official answers though.!
Expo/EAS maintainer here 👋
Use
deviceinstead ofsmsfor 2fa as a temporary workaround. The new breaking Apple server changes only seem to apply to the/appleauth/auth/verify/phoneendpoint. This is the endpoint that sends an SMS to a phone.You can only send four codes every one hour before getting rate limited, making this particularly challenging to decipher. It also appears to be geotagged, and primarily targeting US-based phone numbers.
Not sure if there’s any expo/eas users here, but I’m running into the same issue when trying to sign in to my Apple account using any
easservices likebuild,credentials, etc. I’m guessing it uses fastlane under the hood? I’ve also tried again several days apart and no luck.I’m having the same problem. Upgrading fastlane to the latest version doesn’t seem to help.
I know this seems like a duplicate of #21993, but I am still running into this and would appreciate any insight into how to resolve this besides “just wait XXX amount of time and retry”.
My organization provides whitelabel applications of our product to our customers so being able to automate the creation of apps in the dev portal and ASC is paramount. Otherwise, I’m stuck manually doing that busy work.