Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4862 pages

Help for owners

Customers suddenly can't log in with Apple on my app or website

Short answer

When Sign in with Apple stopped working without any release, the usual cause is an expired client secret. That secret is a signed token your server sends to Apple, and Apple refuses any expiry more than 15777000 seconds, about six months, ahead. Once it lapses, Apple answers invalid_client and logins fail until a new secret is generated.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • The Apple login button opens, but the app or site shows an error after Face ID.
  • Google and email logins work; only Apple fails.
  • It broke on a date when nobody released anything.
  • My developer's logs mention invalid_client or invalid_grant.
  • It worked for about six months after launch and then stopped.

Why does this happen?

  1. The client secret has a six-month ceiling

    Apple's guide to creating a client secret says the token carries an expiration time, and it is an error to request one more than 15777000 seconds (six months) in the future. A secret generated once at launch and never refreshed will expire on schedule.

  2. Apple rejects an expired or badly signed secret

    Apple's technote on response errors says token requests return invalid_client when the client_secret is invalid or expired, improperly signed or malformed. It also lists a sub claim that does not match the registered identifier as a common cause.

  3. The login code was used late or twice

    The authorization code Apple returns is single use and valid for five minutes, per Apple's token validation docs. A server that is slow, retries the same code or runs it twice gets invalid_grant.

  4. The return address or identifier changed

    Apple returns unauthorized_client when the redirect_uri is wrong or missing, and invalid_client on the authorization request when the client_id cannot be found. A domain move or a renamed Services ID can cause either.

What can I do about it today?

  1. Note when it stoppedWrite down the first day people could not log in and compare it with your launch date or the last time the login code changed. A gap close to six months points straight at the secret.
  2. Collect the exact errorAsk your developer for the error code in the server logs: invalid_client, invalid_grant or unauthorized_client each point somewhere different.
  3. Check who can reach the Apple keyA new secret is signed with the private key created in your Apple Developer account. Confirm someone on your side has the key file or access to the account.
  4. Offer another way in for nowIf your app has email login or password reset, point affected customers to it on the login screen until Apple login is back.

When should I bring someone in?

  • Nobody knows where the private key or the secret generation code lives.
  • Apple is the main login method and customers are locked out right now.
  • Errors continue after a new secret, which suggests a wrong identifier, domain or key.

How do I handle it?

  1. Read the token claimsI decode the current secret and compare its expiry, team ID, key ID and subject with the values in your Apple Developer account.
  2. Generate secrets automaticallyInstead of one secret made by hand, the server creates a fresh signed token on a schedule well before the six-month limit, so the expiry cannot surprise you again.
  3. Check the full login pathRedirect addresses, Services ID, domains and the code exchange timing are tested on iPhone, Android and the web if you offer all three.
  4. Add an alertA simple alert fires if Apple logins start failing, so the next problem shows up in minutes rather than through customer emails.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

How long is a Sign in with Apple client secret valid?

As long as the expiry you set, up to a maximum Apple allows of 15777000 seconds, about six months, from when Apple's servers receive it.

What does invalid_client mean in Sign in with Apple?

On token requests, Apple uses it when the client secret is invalid or expired, improperly signed or malformed. On authorization requests, it means the client_id could not be found.

What does invalid_grant mean for Apple login?

The code or refresh token is invalid, already used or expired, or belongs to a different client. Apple's authorization code is single use and lasts five minutes.

Do I need an app update to fix an expired Apple client secret?

Usually not. The secret is created on your server, so a server change fixes it for all users without a new store release.

Sources

Related help

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.