feat: support multiple aud for apple oauth (#3710)

* support multiple aud

* update

* update

* changeset
This commit is contained in:
KinfeMichael Tariku
2025-08-01 18:10:57 +03:00
committed by GitHub
parent 3225926889
commit c726753e69
2 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"better-auth": patch
---
feat: support for multiple aud for apple oauth

View File

@@ -70,6 +70,7 @@ export interface AppleNonConformUser {
export interface AppleOptions extends ProviderOptions<AppleProfile> {
appBundleIdentifier?: string;
audience?: string;
}
export const apple = (options: AppleOptions) => {
@@ -116,7 +117,12 @@ export const apple = (options: AppleOptions) => {
const { payload: jwtClaims } = await jwtVerify(token, publicKey, {
algorithms: [jwtAlg],
issuer: "https://appleid.apple.com",
audience: options.appBundleIdentifier || options.clientId,
audience:
options.audience && options.audience.length
? options.audience
: options.appBundleIdentifier
? options.appBundleIdentifier
: options.clientId,
maxTokenAge: "1h",
});
["email_verified", "is_private_email"].forEach((field) => {