From 380217b0e08dfc75fff6a9990f15548fa4d40f13 Mon Sep 17 00:00:00 2001 From: theo Date: Sun, 11 Jul 2021 15:46:31 -0700 Subject: [PATCH] include profile on signIn events --- src/server/routes/callback.js | 6 +++--- types/index.d.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/routes/callback.js b/src/server/routes/callback.js index dec6d5180a..631aecae19 100644 --- a/src/server/routes/callback.js +++ b/src/server/routes/callback.js @@ -139,7 +139,7 @@ export default async function callback(req, res) { }) } - await dispatchEvent(events.signIn, { user, account, isNewUser }) + await dispatchEvent(events.signIn, { user, account, profile, isNewUser }) // Handle first logins on new accounts // e.g. option to send users to a new account landing page on initial login @@ -286,7 +286,7 @@ export default async function callback(req, res) { }) } - await dispatchEvent(events.signIn, { user, account, isNewUser }) + await dispatchEvent(events.signIn, { user, account, profile, isNewUser }) // Handle first logins on new accounts // e.g. option to send users to a new account landing page on initial login @@ -409,7 +409,7 @@ export default async function callback(req, res) { ...cookies.sessionToken.options, }) - await dispatchEvent(events.signIn, { user, account }) + await dispatchEvent(events.signIn, { user, account, profile: null }) return res.redirect(callbackUrl || baseUrl) } diff --git a/types/index.d.ts b/types/index.d.ts index ee3489d307..8f989ae08c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -363,6 +363,7 @@ export type EventCallback = ( export interface SignInEventMessage { user: User account: Account + profile: Profile | null isNewUser?: boolean }