[PR #966] [MERGED] fix: sign In with Apple With ID Token not work #11813

Closed
opened 2026-04-13 08:01:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/966
Author: @hyoban
Created: 12/20/2024
Status: Merged
Merged: 12/20/2024
Merged by: @Bekacru

Base: mainHead: fix/apple-login


📝 Commits (4)

📊 Changes

2 files changed (+9 additions, -3 deletions)

View changed files

📝 docs/content/docs/authentication/apple.mdx (+4 -0)
📝 packages/better-auth/src/social-providers/apple.ts (+5 -3)

📄 Description

The main thing that tripped me up, is that better-auth requires clientId and clientSecret on socialProviders.apple in config -> this is where you're place the service id and jwt secret generated from p8-file for "Sign-in with Apple" on web.
However on native iOS, it doesn't use the service id but the app id (bundle id) as client id, so if using the service id as clientId in signIn.social() with idToken, it throws an error: JWTClaimValidationFailed: unexpected "aud" claim value.

For iOS native "SignIn with Apple" with idToken, it expects the app/bundle id as clientId and doesn't require the clientSecret.

https://github.com/better-auth/better-auth/issues/421#issuecomment-2466911181

The return value of the decodeJwt function is already the payload


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/966 **Author:** [@hyoban](https://github.com/hyoban) **Created:** 12/20/2024 **Status:** ✅ Merged **Merged:** 12/20/2024 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/apple-login` --- ### 📝 Commits (4) - [`b671ca6`](https://github.com/better-auth/better-auth/commit/b671ca67a288325db25bc4ea501ae1ddd8b5fea1) fix: add appBundleIdentifier option for apple login - [`ca543c0`](https://github.com/better-auth/better-auth/commit/ca543c050437da96a9bef06acd3cc4d45bdc92c3) docs: update - [`1393538`](https://github.com/better-auth/better-auth/commit/139353844d77bf24c76ab1daffd6597513be1372) fix: decode can not find - [`73aa238`](https://github.com/better-auth/better-auth/commit/73aa23814cbcbc8dd1c1a8f0a15cd05a9ed88c5f) chore: update ### 📊 Changes **2 files changed** (+9 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/authentication/apple.mdx` (+4 -0) 📝 `packages/better-auth/src/social-providers/apple.ts` (+5 -3) </details> ### 📄 Description > The main thing that tripped me up, is that better-auth requires clientId and clientSecret on socialProviders.apple in config -> this is where you're place the service id and jwt secret generated from p8-file for "Sign-in with Apple" on web. However on native iOS, it doesn't use the service id but the app id (bundle id) as client id, so if using the service id as clientId in signIn.social() with idToken, it throws an error: JWTClaimValidationFailed: unexpected "aud" claim value. > For iOS native "SignIn with Apple" with idToken, it expects the app/bundle id as clientId and doesn't require the clientSecret. https://github.com/better-auth/better-auth/issues/421#issuecomment-2466911181 The return value of the `decodeJwt` function is already the payload --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 08:01:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#11813