fastlane: Authentication credentials are missing or invalid. - Provide a properly configured and signed bearer token, and make sure that it has not expired

New Issue Checklist

Issue Description

Started receiving the Authentication credentials are missing or invalid. - Provide a properly configured and signed bearer token, and make sure that it has not expired message…

We had not changed anything in our Fastlane and the API Keys have not been revoked. I have even tested by creating a new API Key on the itunesConnect.

Command executed
      api_key = app_store_connect_api_key(
        key_id: "GXXXXXX",
        issuer_id: "69a6de85-xxxxxx-5b8c7c11a4d1",
        key_content: "-----BEGIN PRIVATE KEY-----\nMIqjg1/eUB\nLxxyWE/va\nBWxxxQW3zb\n-----END PRIVATE KEY-----",
        in_house: false
      )

      sigh(
        api_key: api_key,
        adhoc: true,
        force: true
      )

I have also tied to just use CI env var which no change.

Complete output when running fastlane, including the stack trace and command used

Authentication credentials are missing or invalid. - Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 34 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@crazymanish I think there is an issue regardless… I tested by putting everything into a json so I could just run fastlane sigh --api_key_path fastlane/api_key_admin.json NO Duration set - Doesn’t Work Duration of 1200: Doesn’t work Duration of 800: Doesn’t work Duration of 500: 👍 works

Adding 500 seconds duration sounds crazy workaround, but I don’t surprise with Apple 🍏🍎 anymore 😇😂

Doesn’t work for us, even with duration set to 500.

@crazymanish I think there is an issue regardless… I tested by putting everything into a json so I could just run fastlane sigh --api_key_path fastlane/api_key_admin.json NO Duration set - Doesn’t Work Duration of 1200: Doesn’t work Duration of 800: Doesn’t work Duration of 500: 👍 works

@khoogheem Hi I am facing the same issue , but I don’t understand where I can add this duration in fastfile and I don’t understand the Json file solution

    app_store_connect_api_key(
       key_id: "XXXXXXXXXXX",
       issuer_id: "XXXXXXXXXXXXXXXXXXXXXX",
       key_content: "XXXXXXXXXXXXXXXXX",
       
       is_key_content_base64: true,
       in_house: false #boolean value if team is Enterprise or not
     )


    # Get the required provisioning profiles
    bundle_identifiers.each do |identifier|
      sigh app_identifier: identifier,
           provisioning_name: provisioning_profile_name(identifier, export_method),
           adhoc: export_method == :adhoc,
           force: export_method == :adhoc
    end

I’m facing this issue again since 5days… what’s it’s interesting when I use app_store_connect_api_key again, then it works fine in second run… I got duration set on: 1200

[17:03:27]: Setting Provisioning Profile type to 'development'
[17:14:33]: Authentication credentials are missing or invalid. - Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens

I think that there maybe an issue on apple with generation such keys, and then it produces one with default values.

Totally! I can confirm that duration of 500 also does the trick for us.

We are seeing the same issue suddenly with a key that was working fine. It does look like an issue with Apple’s API, given that I am unable to create a new token in the App Store Connect, seeing bunch of 500 errors in the developer console.

same issue (without duration)

this is interesting…reopening

Works for me too with duration 500 🥇

Hi all,

I’m facing the same issue here. Does anyone know how to change the token session duration on the Azure DevOps extension for the Apple App Store? Would it be possible via additional fastlane arguments on the task or using an environment variable? Thanks in advance!

Seems to be fixed.

Okay, cool! I am not sure why this is causing this suddenly, don’t have an AppStoreConnectAPI key to debug this issue. 🤪 I am tagging @joshdholtz for this issue! 😇

We are having the same issue using the key with the admin role:


12:30:33  [11:30:36]: Verifying that the certificate and profile are still valid on the Dev Portal...

12:30:33  [11:30:36]: Creating authorization token for App Store Connect API

12:30:34  [11:30:36]: #<Spaceship::UnauthorizedAccessError: Authentication credentials are missing or invalid. - Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens>```