Skip to content

Commit a683d15

Browse files
fix(web): Fix issue where sign-in with a SSO provider would fail after upsell without a resatrt
1 parent f29c508 commit a683d15

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/web/src/auth.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ export const getProviders = async () => {
153153
return providers;
154154
}
155155

156-
const nextAuthResult = NextAuth({
156+
// @note we use lazy initialization here to ensure that the
157+
// `providers` property is upto date with any config changes.
158+
// @see https://authjs.dev/reference/nextjs#lazy-initialization
159+
const nextAuthResult = NextAuth(async () => ({
157160
secret: env.AUTH_SECRET,
158161
adapter: EncryptedPrismaAdapter(__unsafePrisma),
159162
session: {
@@ -401,10 +404,10 @@ const nextAuthResult = NextAuth({
401404
providers: (await getProviders()).map((provider) => provider.provider),
402405
pages: {
403406
signIn: "/login",
404-
// We set redirect to false in signInOptions so we can pass the email is as a param
407+
// We set redirect to false in signInOptions so we can pass the email in as a param
405408
// verifyRequest: "/login/verify",
406409
}
407-
});
410+
}));
408411

409412
export const { handlers, signIn, signOut } = nextAuthResult;
410413

0 commit comments

Comments
 (0)