zor
zor
Explore posts from servers
CCConvex Community
Created by zor on 9/4/2024 in #support-community
Are there any examples of best security practices for implementing role-based access control (RBAC)
Are there any examples of best security practices for implementing role-based access control (RBAC) when making requests in a Next.js application using Clerk for authentication and Convex as the backend? Specifically, how should server-side validation be approached?
8 replies
CCConvex Community
Created by zor on 7/15/2024 in #support-community
Clerk authenticates, Convex do user management and features. Convex stores user data
Objective Minimal Clerk Side: Use Clerk primarily for user authentication. Convex for User Data Management: Store and manage all user-related data within Convex. Key Steps Set Up Convex Schema: Define the user schema in Convex to store necessary user data fields. Use Convex for Data Operations: Implement queries and mutations in Convex to manage user data, ensuring that all relevant user information is stored in Convex so I can process. I won't create custom flows with Clerk but I will build custom flows with my own database(fetch from my own DB, since storing the same data with Clerk which means similar thing) and backend but Clerk securely handles authentication E.g. I won't use useUser(); from Clerk but useMyDatabaseUser(); In the philosophy of store minimal in Clerk. Isn't it better to manage such features¹ in Convex rather than Clerk? ¹:
last_sign_in_at: number | null;
last_active_at: number | null;
password_last_updated_at: number | null;
two_factor_enabled: boolean;
external_accounts: ExternalAccountJSON[];
last_sign_in_at: number | null;
last_active_at: number | null;
password_last_updated_at: number | null;
two_factor_enabled: boolean;
external_accounts: ExternalAccountJSON[];
E.g. features² probably something we wouldn't have in Convex and Clerk has some characteristics on them ²:
lockout_expires_in_seconds: number | null;
verification_attempts_remaining: number | null;
external_accounts: ExternalAccountJSON[];
banned: boolean;
locked: boolean;

lockout_expires_in_seconds: number | null;
verification_attempts_remaining: number | null;
external_accounts: ExternalAccountJSON[];
banned: boolean;
locked: boolean;

Feel free to share some insights! My approach is copying the UserJSON to my database. Manage the user data from my databases User object and sync when it changes So I will never use useUser() and as I said, useMyDatabaseUser()
39 replies
CCConvex Community
Created by zor on 4/28/2024 in #support-community
Is there anything that I should know about using Kinde auth in Convex backend app?
I know Clerk and Convex is valid but I can't find anything about Kinde and Convex on internet
83 replies
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
CCConvex Community
Created by zor on 2/18/2024 in #support-community
Where and how can I define my table?
No description
7 replies