Skip to content

Commit 18c3dab

Browse files
committed
formatting
1 parent 6bc883f commit 18c3dab

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

packages/web/src/auth.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,15 @@ const nextAuthResult = NextAuth({
241241
callbacks: {
242242
async signIn({ account }) {
243243
const matchingProvider = account
244-
? getProviders().find((p) => {
245-
const providerId = typeof p.provider === 'function'
246-
? p.provider().id
247-
: p.provider.id;
248-
return providerId === account.provider;
249-
})
250-
: undefined;
251-
252-
const isAccountLinkingAttempt =
253-
(account?.type === 'oauth' || account?.type === 'oidc') &&
254-
matchingProvider?.purpose === 'account_linking';
255-
244+
? getProviders().find((p) => {
245+
const providerId = typeof p.provider === 'function'
246+
? p.provider().id
247+
: p.provider.id;
248+
return providerId === account.provider;
249+
})
250+
: undefined;
251+
252+
256253
// Refuse OAuth signin for providers configured purely for account
257254
// linking when no authenticated user is present on the request.
258255
//
@@ -272,6 +269,7 @@ const nextAuthResult = NextAuth({
272269
// `AccessDenied` before handleLoginOrRegister can run, redirecting
273270
// the user to the error page instead of leaving them stranded as a
274271
// new orphan identity with no UserToOrg row.
272+
const isAccountLinkingAttempt = matchingProvider?.purpose === 'account_linking';
275273
const session = await auth();
276274
if (isAccountLinkingAttempt && session === null) {
277275
return false;

0 commit comments

Comments
 (0)