I have several reports of publishing to Google Play failing with this error:
/root/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/fastlane-2.214.0/fastlane_core/lib/fastlane_core/ui/interface.rb:141:in `user_error!': \e[31m[!] Google Api Error: Unauthorized - Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.\e [0m (FastlaneCore::Interface::FastlaneError)
I am looking into it and report back here what I find.
Thanks,
Chris
There is an open incident with the tool (Fastlane) that we use to call the Google Play APIs.
opened 09:52AM - 13 Sep 23 UTC
### New Issue Checklist
- [x] Updated fastlane to the latest version
- [x] I… read the [Contribution Guidelines](https://github.com/fastlane/fastlane/blob/master/CONTRIBUTING.md)
- [x] I read [docs.fastlane.tools](https://docs.fastlane.tools)
- [x] I searched for [existing GitHub issues](https://github.com/fastlane/fastlane/issues)
### Issue Description
We have a problem that started 2 days ago with publishing Google Play releases.
When running the `release_playstore` lane that use `supply` Google APIs return `Google Api Error: Unauthorized - Request is missing required authentication credential.`
We have checked the service account key and it is valid and does not have an expiry date. Can someone experienced take a look at this problem. The assumption is Google made changes to the way API requests need to be done.
##### Command executed
```
lane :release_playstore do
identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
supply(
package_name: identifier,
metadata_path: "fastlane/metadata/android/#{identifier}",
)
end
```
##### Complete output when running fastlane, including the stack trace and command used
```
| release_status | completed |
| track | beta |
| json_key | /home/vsts/work/_temp/fastlane-serviceaccount.json |
| aab | /home/vsts/work/1/golive-Android-Production/xxx-release.aab |
| skip_upload_apk | false |
| skip_upload_aab | false |
| skip_upload_metadata | false |
| skip_upload_changelogs | false |
| skip_upload_images | false |
| skip_upload_screenshots | false |
| track_promote_release_status | completed |
| validate_only | false |
| check_superseded_tracks | false |
| timeout | 300 |
| deactivate_on_promote | true |
| changes_not_sent_for_review | false |
| rescue_changes_not_sent_for_review | true |
| ack_bundle_installation_warning | false |
+------------------------------------+--------------------------------------------------------------------+
[09:28:36]: Preparing aab at path '/home/vsts/work/1/golive-Android-Production/xxx-release.aab' for upload...
[09:29:02]: Updating track 'beta'...
[09:29:03]: Preparing to upload for language 'de-DE'...
[09:29:04]: Updating changelog for '14551' and language 'de-DE' to default changelog...
[09:29:04]: Preparing to upload for language 'en-US'...
[09:29:04]: Uploading image file fastlane/metadata/android/xxx/en-US/images/featureGraphic.png...
[09:29:07]: Uploading image file fastlane/metadata/android/xxx/en-US/images/icon.png...
[09:29:10]: Uploading screenshot fastlane/metadata/android/xxx/en-US/images/phoneScreenshots/1_en-US.png...
+---------------+---------------------------+
| Lane Context |
+---------------+---------------------------+
| ENVIRONMENT | xxx |
| PLATFORM_NAME | android |
| LANE_NAME | android release_playstore |
+---------------+---------------------------+
[09:29:12]: Google Api Error: Unauthorized - Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
+------+---------------+-------------+
| fastlane summary |
+------+---------------+-------------+
| Step | Action | Time (in s) |
+------+---------------+-------------+
| 1 | opt_out_usage | 0 |
| 💥 | supply | 37 |
+------+---------------+-------------+
[09:29:12]: fastlane finished with errors
[!] Google Api Error: Unauthorized - Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
```
<details>
<pre> [REPLACE THIS WITH YOUR INFORMATION] </pre>
</details>
### Environment
<!--
Please run `fastlane env` and copy the output below. This will help us help you.
If you used the `--capture_output` option, please remove this block as it is already included there.
-->
<details>
<pre> [REPLACE THIS WITH YOUR INFORMATION] </pre>
</details>
I have added detail to the issues.
Another related issue?
opened 12:33PM - 28 Feb 23 UTC
### New Issue Checklist
- [x] Updated fastlane to the latest version
- [x] I… read the [Contribution Guidelines](https://github.com/fastlane/fastlane/blob/master/CONTRIBUTING.md)
- [x] I read [docs.fastlane.tools](https://docs.fastlane.tools)
- [x] I searched for [existing GitHub issues](https://github.com/fastlane/fastlane/issues)
### Issue Description
When we execute the "create_app_on_managed_play_store" lane we're always getting a "Google Api Error: Unauthorized - Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential." error since a month ago. The App in the Managed Google Play Console is not created.
The json we use was generated on a project in Google Cloud Platform and has privileges to execute Google Play APIs (Google Play Android Developer API and Google Play Custom App Publishing API) and also has admin privileges on Managed Google Play Console. Prior to a month ago, it always worked fine.
It seems that Google requires a different authentication method now? It is possible that fastlane has not adapted?
##### Command executed
fastlane run create_app_on_managed_play_store
##### Complete output when running fastlane, including the stack trace and command used
<!--
You can use `--capture_output` as the last command line argument for many commands to get that collected for you. Otherwise, please do it manually.
Caution: The output of `--capture_output` could contain sensitive data such as application ids, certificate ids, or email addresses. Please make sure you double check the output and replace anything sensitive you don't wish to submit in the issue
-->
<details>
<pre> vmontana@K9XLDQKJR9 fastlane % fastlane run create_app_on_managed_play_store language:"es_ES"
[✔] 🚀
[08:38:47]: fastlane detected a Gemfile in the current directory
[08:38:47]: However, it seems like you didn't use `bundle exec`
[08:38:47]: To launch fastlane faster, please use
[08:38:47]:
[08:38:47]: $ bundle exec fastlane run create_app_on_managed_play_store language:es_ES
[08:38:47]:
[08:38:47]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[08:38:48]: ----------------------------------------------
[08:38:48]: --- Step: create_app_on_managed_play_store ---
[08:38:48]: ----------------------------------------------
[08:38:48]: To not be asked about this value, you can specify it using 'json_key'
[08:38:48]: The service account json file used to authenticate with Google: ./mdona-cloud-dev-cicdmovd.json
+----------+------------------------------------------------------------+
| Summary for create_app_on_managed_play_store |
+----------+------------------------------------------------------------+
| language | es_ES |
| json_key | /Users/vmontana/Documents/fastlane/mdona-cloud-dev-cicdmo |
| | vd.json |
| apk | oficinas_and-1.2.61(23022711).apk |
| timeout | 300 |
+----------+------------------------------------------------------------+
[08:39:04]: To not be asked about this value, you can specify it using 'app_title'
[08:39:04]: App Title: oficinas_and
[08:39:45]: To not be asked about this value, you can specify it using 'developer_account_id'
[08:39:45]: The ID of your Google Play Console account. Can be obtained from the URL when you log in
(`https://play.google.com/apps/publish/?account=...` or when you 'Obtain private app publishing rights'
(https://developers.google.com/android/work/play/custom-app-api/get-started#retrieve_the_developer_account_id): <HIDDEN_VALUE>
[!] Google Api Error: Unauthorized - Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. </pre>
</details>
### Environment
<!--
Please run `fastlane env` and copy the output below. This will help us help you.
If you used the `--capture_output` option, please remove this block as it is already included there.
-->
<details>
<pre> <details><summary>✅ fastlane environment ✅</summary>
### Stack
| Key | Value |
| --------------------------- | ------------------------------------------------ |
| OS | 12.6.3 |
| Ruby | 3.2.1 |
| Bundler? | false |
| Git | git version 2.37.1 (Apple Git-137.1) |
| Installation Source | /opt/homebrew/lib/ruby/gems/3.2.0/bin/fastlane |
| Host | macOS 12.6.3 (21G419) |
| Ruby Lib Dir | /opt/homebrew/Cellar/ruby/3.2.1/lib |
| OpenSSL Version | OpenSSL 1.1.1t 7 Feb 2023 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode-14.2.app/Contents/Developer/ |
| Xcode Version | 14.2 |
| Swift Version | 5.7.2 |
### System Locale
| Variable | Value | |
| -------- | ----------- | - |
| LANG | es_ES.UTF-8 | ✅ |
| LC_ALL | | |
| LANGUAGE | | |
### fastlane files:
**No Fastfile found**
**No Appfile found**
### fastlane gems
| Gem | Version | Update-Status |
| -------- | ------- | ------------- |
| fastlane | 2.212.1 | ✅ Up-To-Date |
### Loaded fastlane plugins:
**No plugins Loaded**
<details><summary><b>Loaded gems</b></summary>
| Gem | Version |
| ------------------------------- | ------------ |
| error_highlight | 0.5.1 |
| did_you_mean | 1.6.3 |
| syntax_suggest | 1.0.2 |
| atomos | 0.1.3 |
| rexml | 3.2.5 |
| CFPropertyList | 3.0.6 |
| claide | 1.1.0 |
| colored2 | 3.1.2 |
| nanaimo | 0.3.0 |
| xcodeproj | 1.22.0 |
| rouge | 2.0.7 |
| xcpretty | 0.3.0 |
| terminal-notifier | 2.0.0 |
| unicode-display_width | 1.8.0 |
| terminal-table | 1.8.0 |
| plist | 3.7.0 |
| public_suffix | 5.0.1 |
| addressable | 2.8.1 |
| multipart-post | 2.0.0 |
| word_wrap | 1.0.0 |
| optparse | 0.1.1 |
| tty-screen | 0.8.1 |
| tty-cursor | 0.7.1 |
| tty-spinner | 0.9.3 |
| artifactory | 3.0.15 |
| babosa | 1.0.4 |
| colored | 1.2 |
| highline | 2.0.3 |
| commander | 4.6.0 |
| excon | 0.99.0 |
| faraday-em_http | 1.0.0 |
| faraday-em_synchrony | 1.0.0 |
| faraday-excon | 1.1.0 |
| faraday-httpclient | 1.0.1 |
| faraday-multipart | 1.0.4 |
| faraday-net_http | 1.0.1 |
| 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.3 |
| unf_ext | 0.0.8.2 |
| unf | 0.1.4 |
| domain_name | 0.5.20190701 |
| http-cookie | 1.0.5 |
| faraday-cookie_jar | 0.0.7 |
| faraday_middleware | 1.2.0 |
| fastimage | 2.2.6 |
| gh_inspector | 1.1.3 |
| json | 2.6.3 |
| mini_magick | 4.12.0 |
| naturally | 2.2.1 |
| rubyzip | 2.3.2 |
| security | 0.1.3 |
| xcpretty-travis-formatter | 1.0.1 |
| dotenv | 2.8.1 |
| bundler | 2.4.6 |
| simctl | 1.6.10 |
| jwt | 2.7.0 |
| uber | 0.1.0 |
| declarative | 0.0.20 |
| trailblazer-option | 0.1.2 |
| representable | 3.2.0 |
| retriable | 3.1.2 |
| mini_mime | 1.1.2 |
| memoist | 0.16.2 |
| multi_json | 1.15.0 |
| os | 1.1.4 |
| signet | 0.17.0 |
| googleauth | 1.3.0 |
| httpclient | 2.8.3 |
| webrick | 1.8.1 |
| google-apis-core | 0.11.0 |
| google-apis-playcustomapp_v1 | 0.12.0 |
| google-apis-androidpublisher_v3 | 0.34.0 |
| google-cloud-env | 1.6.0 |
| google-cloud-errors | 1.3.0 |
| google-cloud-core | 1.6.0 |
| google-apis-iamcredentials_v1 | 0.17.0 |
| google-apis-storage_v1 | 0.19.0 |
| rake | 13.0.6 |
| digest-crc | 0.6.4 |
| google-cloud-storage | 1.44.0 |
| emoji_regex | 3.2.3 |
| jmespath | 1.6.2 |
| aws-partitions | 1.716.0 |
| aws-eventstream | 1.2.0 |
| aws-sigv4 | 1.5.2 |
| aws-sdk-core | 3.170.0 |
| aws-sdk-kms | 1.62.0 |
| aws-sdk-s3 | 1.119.1 |
| set | 1.0.3 |
| forwardable | 1.3.3 |
| logger | 1.5.3 |
| pathname | 0.2.1 |
| shellwords | 0.1.0 |
| cgi | 0.3.6 |
| date | 3.3.3 |
| timeout | 0.3.1 |
| securerandom | 0.2.2 |
| uri | 0.12.0 |
| openssl | 3.1.0 |
| digest | 3.1.1 |
| ipaddr | 1.2.5 |
| resolv | 0.2.2 |
| time | 0.2.1 |
| stringio | 3.0.4 |
| open-uri | 0.3.0 |
| mutex_m | 0.1.2 |
| net-http | 0.3.2 |
| net-protocol | 0.2.1 |
| ostruct | 0.5.5 |
| english | 0.7.2 |
| erb | 4.0.2 |
| abbrev | 0.1.1 |
| tempfile | 0.1.3 |
| delegate | 0.3.0 |
| fileutils | 1.7.0 |
| tmpdir | 0.1.3 |
| base64 | 0.1.1 |
| singleton | 0.1.1 |
| open3 | 0.1.2 |
| nkf | 0.1.2 |
| prettyprint | 0.1.1 |
| pp | 0.4.0 |
| find | 0.1.1 |
| yaml | 0.2.1 |
| psych | 5.0.1 |
</details>
*generated on:* **2023-02-28**
</details> </pre>
</details>
Chris
Fastlane has provided a work-around for now. If it fails the first time, then it retries.
The number of retries is defaulted by Scriptoria to 5 times. It can be configured by the
SUPPLY_UPLOAD_MAX_RETRIES publishing property.
I have you further problems with the publishing failing due to this issue (with the retries in place), please let me know.
Chris
This has been working for the most part. There have been a couple of apps that still failed with 5 retries (and they had to increase the retries … I haven’t heard yet if this worked).
I have submitted a support request to Google Play (they are slow to respond).
Thanks,
Chris
Good news. The project that failed yesterday with retries=5 , it ran again today with retries=12 but there were no failures. Maybe they have fixed the underlying problem?
Chris
From a Comment on the issue
I discussed with the Play team yesterday, and they had identified an issue which may have contributed to this issue. They believe they have now fixed this issue.
It isn’t confirmed that the issue that they identified and fixed was indeed the cause of the issue Fastlane has been experiencing, but we’d be interested to know whether users of Fastlane are now seeing an improvement, with no more failures, and no more need for retries?
This is promising and I am hoping the actual problem is fixed.
Chris