fastlane / fastlane

πŸš€ The easiest way to automate building and releasing your iOS and Android apps
https://fastlane.tools
MIT License
38.74k stars 5.63k forks source link

"Google Api Error: Unauthorized - Request is missing required authentication credential" running create_app_on_managed_play_store/upload_to_play_store lanes #21091

Open vmontana opened 1 year ago

vmontana commented 1 year ago

New Issue Checklist

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
 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): 

[!] 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. 

Environment

 
βœ… fastlane environment βœ… ### 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**
Loaded gems | 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 |
*generated on:* **2023-02-28**
muhammadqazi commented 1 year ago

@vmontana try this guide https://medium.com/@muhammedqazi/mastering-fastlane-the-ultimate-guide-to-effortless-android-and-ios-deployments-with-github-e0878c3f9529

vmontana commented 1 year ago

Hi @muhammadqazi , the guide you provide doesn't explains how to upload android apps in a Managed Google Play Console Account (Android Enterprise). In this type of account, you cannot use the "API access" section. It also doesn't explain that you need to enable a second API on GCP called "Google Play Custom App Publishing API".

Does the exact lane "create_app_on_managed_play_store" work for you?

Thanks!

vmontana commented 1 year ago

Hi. Does the "create_app_on_managed_play_store" lane work for anyone?

To check if it is a general issue or not.

Thanks.

marcosrocha85 commented 1 year ago

@vmontana try this guide https://medium.com/@muhammedqazi/mastering-fastlane-the-ultimate-guide-to-effortless-android-and-ios-deployments-with-github-e0878c3f9529

Your tutorial guided me to use json_key with upload_to_play_store and solved authentication issue.

upload_to_play_store(track: 'internal', json_key: json_key_file)
mvrty commented 1 year ago

Hi

Getting the same when running upload_to_play_store - worked 3 weeks ago. Setting store/key pw, store file and alias in gradle properties.

marcosrocha85 commented 1 year ago

@vmontana @mvrty What happens when you put json_key property to your create_app_on_managed_play_store?

create_app_on_managed_play_store(
  json_key: 'path/to/you/json/key/file',
  ...
)
mvrty commented 1 year ago

Actually re-ran the job after a while and it went through without a problem. Some issues at play store today maybe?

vmontana commented 1 year ago

@marcosrocha85 & @mvrty : You have commented the behavior of the "upload_to_play_store" lane. That is not the lane for which the case has been opened. Does the exact lane "create_app_on_managed_play_store" work for you?

@marcosrocha85 : We were already putting the json_key parameter as you indicate and it fails with the same error.

Fastfile:

platform :android do

  desc "Crear App en Google Play Console Administrado de ITG."
  lane :create_app_on_managed_play_store_itg do
    create_app_on_managed_play_store(
      json_key: "/Users/vmontana/Documents/fastlane/mdona-cloud-itg-cicdmovd.json",
      developer_account_id: "<HIDDEN-VALUE>",
      app_title: "HelloWorldITG2",
      language: 'es_ES',
      apk: "/Users/vmontana/Documents/fastlane/HelloWorldITG2.apk",
    )
  end

end

Execution:

vmontana@K9XLDQKJR9 fastlane % bundle exec fastlane android create_app_on_managed_play_store_itg
[βœ”] πŸš€ 
[09:09:30]: Driving the lane 'android create_app_on_managed_play_store_itg' πŸš€
[09:09:30]: ----------------------------------------------
[09:09:30]: --- Step: create_app_on_managed_play_store ---
[09:09:30]: ----------------------------------------------

+----------------------+------------------------------------------------------------+
|                   Summary for create_app_on_managed_play_store                    |
+----------------------+------------------------------------------------------------+
| json_key             | /Users/vmontana/Documents/fastlane/mdona-cloud-itg-cicdmo  |
|                      | vd.json                                                    |
| developer_account_id | <HIDDEN-VALUE>                                             |
| app_title            | HelloWorldITG2                                             |
| language             | es_ES                                                      |
| apk                  | /Users/vmontana/Documents/fastlane/HelloWorldITG2.apk      |
| timeout              | 300                                                        |
+----------------------+------------------------------------------------------------+

+---------------+----------------------------------------------+
|                         Lane Context                         |
+---------------+----------------------------------------------+
| PLATFORM_NAME | android                                      |
| LANE_NAME     | android create_app_on_managed_play_store_itg |
+---------------+----------------------------------------------+
[09:09:35]: 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) |
+------+----------------------------------+-------------+
| πŸ’₯   | create_app_on_managed_play_store | 4           |
+------+----------------------------------+-------------+

[09:09:35]: 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.
vmontana@K9XLDQKJR9 fastlane % 

The same code and files worked 2 months ago. What has changed?

androideveloper commented 1 year ago

Same here, started failing more frequently today

giona69 commented 1 year ago

same here, it is failing since today at 11:30 CET

previous build working perfectly, nothing changed in our configuration

imtoori commented 1 year ago

same here

giona69 commented 1 year ago

any news

vmontana commented 1 year ago

Hello,

I'm still facing this issue only with "create_app_on_managed_play_store" lane.

Does it work for anyone?

vmontana commented 1 year ago

It seems that few people use this lane.

Has anyone used it recently? Hi @joshdholtz ! Could you tell me if this lane is still working OK? Thanks!

fxcjahid commented 1 year ago

image The problem was there we should set this Access token location: access_token url paramater

vmontana commented 1 year ago

Hi @fxcjahid ,

It's an issue that the client side can solve? Or is a new release of fastlane needed?

Thanks!

fxcjahid commented 1 year ago

I don't know, But this is server-side

vmontana commented 1 year ago

Hello,

Could any fastlane developer please confirm if this is an issue that could be resolved with a new version of fastlane?

Thanks!

AlkanV commented 8 months ago

hello, is there any update on this one? i am also experiencing same issue.

soulduse commented 8 months ago

same issue too

ademirqueiroga commented 8 months ago

I have the same problem intermittently while using supply

JaredMKatz commented 8 months ago

Same Issue, are there any updates?

sregg commented 8 months ago

Any workaround here? Build stopped working this today.

canturkay commented 8 months ago

I'm facing the same issue, any updates here?

bimusiek commented 8 months ago

We have the same problem, JSON keys are ok, permissions are there. If anyone has a solution, please tell us! :)

denissb commented 8 months ago

This is happening on our project as well, started facing it 2 days ago. I created a new issue #21507 as this does not seem to be related with create_app_on_managed_play_store command.

shekit commented 8 months ago

facing this same issue from today

joarkosberg commented 8 months ago

Started getting this yesterday as well, not on every run, but about 75% of the time.

Pipding commented 8 months ago

I'm also seeing this on the upload_to_play_storecommand. Last ran successfully on 7th September. No runs over the weekend but since Monday it's failed consistently. No config changes on our end

johnbizokk commented 8 months ago

The same issue if we are trying to upload more than one localization at a time.

dhimanrascon commented 8 months ago

We're facing the same issue. Please help. We've a production release today.

dhimanrascon commented 8 months ago

We're facing the same issue. Please help. We've a production release today.

hemachandsai commented 8 months ago

Started getting this from yesterday. It is being triggered when fastlane is trying to sync image metadata. Please help!!

humanzai commented 8 months ago

We are having the same issue

adamplenti commented 8 months ago

Same issue in Bitrise workflow

adamplenti commented 8 months ago

Same issue in Bitrise workflow

rebuild fix the problem. for now.

hemachandsai commented 8 months ago

https://github.com/fastlane/fastlane/issues/21507 the same scenario for us too, the error gets triggered during screenshots upload

agap commented 8 months ago

I ended up building and uploading our build manually for now.

hakunatomata commented 8 months ago

Same on my side for upload_to_play_store since today - worked all the time. Checked JSON_KEY_FILE but all good. No code changes at all.

YaserH25 commented 8 months ago

same issue, i ended up deploying it manually

vmontana commented 8 months ago

I opened this case for the "create_app_on_managed_play_store" lane (Android enterprise private apps). I am still facing this problem since February without a solution yet.

Now, I'm getting the same error in the 'public' lane "upload_to_play_store" like you guys. It seems like the same problem is affecting both lanes.

Please, Fastlane developers, could you check what's going on?

sregg commented 8 months ago

I confirm, by setting these params, the upload goes through successfully:

      skip_upload_metadata: true,
      skip_upload_images: true,
      skip_upload_screenshots: true,
Pipding commented 8 months ago

I confirm, by setting these params, the upload goes through successfully:

No such luck on my end. Our config already includes those params

matthewparavati commented 8 months ago

We just started getting this error yesterday for the upload_to_play_store lane. It was working fine as of last Friday (9/8) πŸ˜‘ 🀦

mirkos93 commented 8 months ago

I think Google has made some changes to the API. I'm encountering this issue because I've integrated the Play Store API into my project, and I've been receiving the same error since yesterday..

fabiendem commented 8 months ago

We have the same issue with Bitrise, and they have similar reports. It's an issue on Google's side.

Pipding commented 8 months ago

I think Google has made some changes to the API.

That's possible. The failed uploads include the following output

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.](https://developers.google.com/identity/sign-in/web/devconsole-project)

The linked page has a deprecation warning at the top but it also links to a deprecation & sunsetting page where the sunset date is still marked as TBD. It seems plausible that Google sunsetted something without proper notice, but what makes me doubt it is that a few people in this thread have reported successful uploads. Maybe it's something less drastic.

fabiendem commented 8 months ago

Google Cloud status is green: https://status.cloud.google.com/ Previous incident last night, not sure it's related: https://status.cloud.google.com/incidents/71zrZxw3PRkiNYhM1JsZ

tijojose27 commented 8 months ago

Started facing this issue again today while using fastlane on Azure pipelines...last months release worked fine

brianjd commented 8 months ago

Been working fine for months, now encountering the same issue, both play store and test lanes:

Store Google Api Error: Server error - Internal error encountered.

Test 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.