zor
zor
KKinde
Created by zor on 4/27/2024 in #💻┃support
Should I include user model in database schema? And how to handle users registering their business?
No description
13 replies
KKinde
Created by zor on 3/4/2024 in #💻┃support
Next.js - Middleware for Kinde & Redirect to login page
Hi, I'm coming from a Kinde competitor, I love Kinde. It has many more advantage for me also how it already includes the 2FA. I am using Next.js 14 I want to redirect user to login page directly. Docs says 💡 As of right now the middleware in the app router does not work when trying to redirect to api/auth/login. This is because of Next.js caching which causes issues during authentication.. So do I have to put
const { isAuthenticated, isLoading } = useKindeBrowserClient();

if (isLoading)
return (
<div>Loading...</div>
)
return isAuthenticated ? (
<div>You can see this page.</div>
) : (
<div>
You have to <LoginLink>Login</LoginLink> to see this page.
</div>
const { isAuthenticated, isLoading } = useKindeBrowserClient();

if (isLoading)
return (
<div>Loading...</div>
)
return isAuthenticated ? (
<div>You can see this page.</div>
) : (
<div>
You have to <LoginLink>Login</LoginLink> to see this page.
</div>
every page.tsx? Also redirect to sign in would be better UX for. So isn't that possible to use Middleware for my situation?
16 replies
KKinde
Created by zor on 3/3/2024 in #💻┃support
<LoginLink> / <RegisterLink> causes: "Error: (0 , react__WEBPACK_IMPORTED_MODULE_0__.createContext)"
CODE CAUSES ERROR:
import { LoginLink, RegisterLink } from "@kinde-oss/kinde-auth-nextjs";

// ...
<div>
<LoginLink>Sign in</LoginLink>
<RegisterLink>Sign up-</RegisterLink>
</div>
import { LoginLink, RegisterLink } from "@kinde-oss/kinde-auth-nextjs";

// ...
<div>
<LoginLink>Sign in</LoginLink>
<RegisterLink>Sign up-</RegisterLink>
</div>
ERROR:
Server Error
Error: (0 , react__WEBPACK_IMPORTED_MODULE_0__.createContext) is not a function
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
s
node_modules\@kinde-oss\kinde-auth-nextjs\dist\index.js (1:11579)
(rsc)/./node_modules/@kinde-oss/kinde-auth-nextjs/dist/index.js
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/vendor-chunks/@kinde-oss.js (20:1)
__webpack_require__
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/webpack-runtime.js (33:42)
eval
webpack-internal:///(rsc)/./src/app/page.tsx (8:86)
(rsc)/./src/app/page.tsx
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/app/page.js (195:1)
Function.__webpack_require__
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/webpack-runtime.js (33:42)
runNextTicks
node:internal/process/task_queues (60:5)
listOnTimeout
node:internal/timers (540:9)
process.processTimers
node:internal/timers (514:7)
async eq
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:402260)
async tr
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:405987)
async tn
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:406537)
async tn
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:406668)
async tu...
Server Error
Error: (0 , react__WEBPACK_IMPORTED_MODULE_0__.createContext) is not a function
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
s
node_modules\@kinde-oss\kinde-auth-nextjs\dist\index.js (1:11579)
(rsc)/./node_modules/@kinde-oss/kinde-auth-nextjs/dist/index.js
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/vendor-chunks/@kinde-oss.js (20:1)
__webpack_require__
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/webpack-runtime.js (33:42)
eval
webpack-internal:///(rsc)/./src/app/page.tsx (8:86)
(rsc)/./src/app/page.tsx
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/app/page.js (195:1)
Function.__webpack_require__
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/.next/server/webpack-runtime.js (33:42)
runNextTicks
node:internal/process/task_queues (60:5)
listOnTimeout
node:internal/timers (540:9)
process.processTimers
node:internal/timers (514:7)
async eq
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:402260)
async tr
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:405987)
async tn
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:406537)
async tn
file:///C:/Users/CASPER/Desktop/projeler/convexstack/convex-playground/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:406668)
async tu...
7 replies