[PR #3605] [CLOSED] refactor: change apple type and name in order to support multiple audiences #13157

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3605
Author: @dagyu
Created: 7/25/2025
Status: Closed

Base: mainHead: main


📄 Description

In cross-platform applications like Flutter, the aud (audience) claim in Apple ID tokens can differ between platforms:

  • On iOS, the audience is usually the app's bundle identifier (e.g., com.example.myapp)
  • On Android (using web-based Sign in with Apple), the audience is the Services ID (e.g., com.example.myapp.signin)

Currently, better-auth define the audience in this way:

f99305b29e/packages/better-auth/src/social-providers/apple.ts (L119)

In this way I can't support the case where I need multiple string as audience.

To address this, I changed the name ofappBundleIdentifier into audiences and the type from string to string[]. This makes it possible to support both audience values depending on which platform the user is authenticating from.


Summary by cubic

Updated Apple Sign In to support multiple audience values, allowing cross-platform authentication for apps using both bundle identifiers and service IDs.

  • Refactors
  • Renamed the option from appBundleIdentifier to audience and changed its type from string to string[].

🔄 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/3605 **Author:** [@dagyu](https://github.com/dagyu) **Created:** 7/25/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📄 Description In cross-platform applications like Flutter, the `aud` (audience) claim in Apple ID tokens can differ between platforms: - On **iOS**, the audience is usually the app's **bundle identifier** (e.g., `com.example.myapp`) - On **Android** (using web-based Sign in with Apple), the audience is the **Services ID** (e.g., `com.example.myapp.signin`) Currently, `better-auth` define the audience in this way: https://github.com/better-auth/better-auth/blob/f99305b29eb096186a0f85100e01f721d208f2f0/packages/better-auth/src/social-providers/apple.ts#L119 In this way I can't support the case where I need multiple string as audience. To address this, I changed the name of`appBundleIdentifier` into `audiences` and the type from `string` to `string[]`. This makes it possible to support both audience values depending on which platform the user is authenticating from. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated Apple Sign In to support multiple audience values, allowing cross-platform authentication for apps using both bundle identifiers and service IDs. - **Refactors** - Renamed the option from `appBundleIdentifier` to `audience` and changed its type from `string` to `string[]`. <!-- End of auto-generated description by cubic. --> --- <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:48:05 -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#13157