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.
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?
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.
Confirmed by developer.apple.com
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.
Confirmed by developer.apple.com
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.
Confirmed by developer.apple.com
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.
Confirmed by developer.apple.com
What can I do about it today?
- 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.
- 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.
- 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.
- 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?
- 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.
- 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.
- 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.
- 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
- Apple rejected my app because the reviewer cannot log inApple's guideline 2.1 says to include demo account information if your app has a login, and to turn on your back-end service.
- I cannot log in to Plesk or it says my license has expiredIf that fails the key expires.
- Apple rejected my app because people must sign up before they can use itApple's design guidance adds that sign-in should wait as long as possible.
- Apple Developer Membership Expired: App GonePeople who already installed it can keep using it.