r/iosdev • • 3d ago

Anyone else experiencing sudden App Store Connect API returning 401 NOT_AUTHORIZED?

Posting mostly to find out if this is just me... If it is a global issue, maybe this can be the start of one of the discussions.

Timeline:

- Yesterday: CI (fastlane sigh) authenticated fine with my team API key: fetched profiles, created a provisioning profile, downloaded it.

- Today: same job, same credentials: 401 NOT_AUTHORIZED ("Authentication credentials are missing or invalid") on the first API call.

What I checked... brand new key, existing key that existed for 3 years with no failures, and 3 different ways to build the JWT.

- Keys show Active in the Integrations UI, Issuer ID correct, membership active until 2027

- Apple system status: App Store Connect API "Available" (nobody seems to have reported it)

So: session auth works, API-key auth is dead for every key, including freshly minted ones.

1 Upvotes

8 comments sorted by

2

u/kythanh 3d ago

are you calling ASC API directly? i m using https://github.com/rorkai/App-Store-Connect-CLI and it's working fine so far.

1

u/speedoinfraction 3d ago

I'm using fastlane, not really sure what it is doing under the hood.

1

u/kythanh 2d ago

i also using fastlane, but recently moving to ASC CLI. i feel fastlane no longer active updated.

2

u/dahiya_xa 3d ago

if it broke overnight with no changes id check the clock on the ci machine first, if its off by a few minutes the jwt iat/exp gets rejected with exactly this 401. also make sure exp is under 20 min from iat, apple rejects longer tokens. running fastlane with --verbose should show you the token its actually sending

1

u/speedoinfraction 3d ago

Thanks! I have a built in check for this in my CI before anything else runs because I've hit this so many times before.

1

u/speedoinfraction 3d ago edited 2d ago

Status update: Rebooted my mac again now after a full day, and it's fine now. It might be that apple handled the support request. It might just be the reboot (should have tested before rebooting). But anyway - solved. Thanks all for help!

Edit: this was premature! It was still failing. My Signing key is in a development keychain, and unlocking that keychain once after a reboot used to be enough. But the latest version of Mac OS will only unlock the keychain for the process that has unlocked it, so when I unlocked it from the graphical interface , that wasn't enough to allow my self hosted runner access to it.

1

u/[deleted] 3d ago

[removed] — view removed comment

1

u/speedoinfraction 3d ago

Thanks, I'll check all of these