We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On buy page, click on the buy button will not redirect to stripe page unless I refresh the page and then click buy.
Second problem: In the auth-edge.ts file, I have warnings, I have to use ! and as string/boolean to get rid of it.
import { NextAuthConfig } from "next-auth"; import prisma from "./db"; export const nextAuthEdgeConfig = { pages: { signIn: "/login", }, callbacks: { authorized: ({ auth, request }) => { // runs on every request with middleware const isLoggedIn = Boolean(auth?.user); const isTryingToAccessApp = request.nextUrl.pathname.includes("/app"); if (!isLoggedIn && isTryingToAccessApp) { return false; } if (isLoggedIn && isTryingToAccessApp && !auth?.user.hasAccess) { return Response.redirect(new URL("/payment", request.nextUrl)); } if (isLoggedIn && isTryingToAccessApp && auth?.user.hasAccess) { return true; } if ( isLoggedIn && (request.nextUrl.pathname.includes("/login") || request.nextUrl.pathname.includes("/signup")) && auth?.user.hasAccess ) { return Response.redirect(new URL("/app/dashboard", request.nextUrl)); } if (isLoggedIn && !isTryingToAccessApp && !auth?.user.hasAccess) { if ( request.nextUrl.pathname.includes("/login") || request.nextUrl.pathname.includes("/signup") ) { return Response.redirect(new URL("/payment", request.nextUrl)); } return true; } if (!isLoggedIn && !isTryingToAccessApp) { return true; } return false; }, jwt: async ({ token, user, trigger }) => { if (user) { // on sign in token.userId = user.id; token.email = user.email; token.hasAccess = user.hasAccess; } if (trigger === "update") { // on every request const userFromDb = await prisma.user.findUnique({ where: { email: token.email!, }, }); if (userFromDb) { token.hasAccess = userFromDb.hasAccess; } } return token; }, session: ({ session, token }) => { session.user.id = token.userId as string; session.user.hasAccess = token.hasAccess as boolean; return session; }, }, providers: [], } satisfies NextAuthConfig;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
On buy page, click on the buy button will not redirect to stripe page unless I refresh the page and then click buy.
Second problem: In the auth-edge.ts file, I have warnings, I have to use ! and as string/boolean to get rid of it.

The text was updated successfully, but these errors were encountered: