From 142abe3eead208c78e40f76fe518efc64adb2b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Fri, 19 May 2023 16:38:28 +0200 Subject: [PATCH] feat: allow empty `account` mapper --- packages/core/src/lib/callback-handler.ts | 2 +- packages/core/src/providers/oauth.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/lib/callback-handler.ts b/packages/core/src/lib/callback-handler.ts index bae3ade9..4250a6fd 100644 --- a/packages/core/src/lib/callback-handler.ts +++ b/packages/core/src/lib/callback-handler.ts @@ -158,7 +158,7 @@ export async function handleLogin( const { provider: p } = options as InternalOptions<"oauth" | "oidc"> const { type, provider, providerAccountId, userId, ...tokenSet } = account const defaults = { providerAccountId, provider, type, userId } - account = Object.assign(p.account(tokenSet), defaults) + account = Object.assign(p.account(tokenSet) ?? {}, defaults) if (user) { // If the user is already signed in and the OAuth account isn't already associated diff --git a/packages/core/src/providers/oauth.ts b/packages/core/src/providers/oauth.ts index 43cf759a..e7657885 100644 --- a/packages/core/src/providers/oauth.ts +++ b/packages/core/src/providers/oauth.ts @@ -95,7 +95,7 @@ export type ProfileCallback = ( tokens: TokenSet ) => Awaitable -export type AccountCallback = (tokens: TokenSet) => TokenSet +export type AccountCallback = (tokens: TokenSet) => TokenSet | undefined | void export interface OAuthProviderButtonStyles { logo: string