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