mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 04:19:32 +00:00
feat: support multiple aud for apple oauth (#3710)
* support multiple aud * update * update * changeset
This commit is contained in:
committed by
GitHub
parent
3225926889
commit
c726753e69
5
.changeset/strong-points-admire.md
Normal file
5
.changeset/strong-points-admire.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"better-auth": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: support for multiple aud for apple oauth
|
||||||
@@ -70,6 +70,7 @@ export interface AppleNonConformUser {
|
|||||||
|
|
||||||
export interface AppleOptions extends ProviderOptions<AppleProfile> {
|
export interface AppleOptions extends ProviderOptions<AppleProfile> {
|
||||||
appBundleIdentifier?: string;
|
appBundleIdentifier?: string;
|
||||||
|
audience?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const apple = (options: AppleOptions) => {
|
export const apple = (options: AppleOptions) => {
|
||||||
@@ -116,7 +117,12 @@ export const apple = (options: AppleOptions) => {
|
|||||||
const { payload: jwtClaims } = await jwtVerify(token, publicKey, {
|
const { payload: jwtClaims } = await jwtVerify(token, publicKey, {
|
||||||
algorithms: [jwtAlg],
|
algorithms: [jwtAlg],
|
||||||
issuer: "https://appleid.apple.com",
|
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",
|
maxTokenAge: "1h",
|
||||||
});
|
});
|
||||||
["email_verified", "is_private_email"].forEach((field) => {
|
["email_verified", "is_private_email"].forEach((field) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user