K
Kinde9mo ago
KHRM

useKindeBrowserClient shows error

Hello, I am using the useKindeBrowser client to recieve the isAuthenticated property
"use client";

import { useKindeBrowserClient } from "@kinde-oss/kinde-auth-nextjs";
import { LoginLink } from "@kinde-oss/kinde-auth-nextjs/components";
import Link from "next/link";
import { Button } from "@/components/ui/button";

export const GetStartedBtn = () => {
const { isAuthenticated } = useKindeBrowserClient();

return (
<Button variant="secondary" size="lg" asChild>
{isAuthenticated ? (
<Link href="/journal">Get Started</Link>
) : (
<LoginLink postLoginRedirectURL="/login/redirect">
Get Started
</LoginLink>
)}
</Button>
);
};
"use client";

import { useKindeBrowserClient } from "@kinde-oss/kinde-auth-nextjs";
import { LoginLink } from "@kinde-oss/kinde-auth-nextjs/components";
import Link from "next/link";
import { Button } from "@/components/ui/button";

export const GetStartedBtn = () => {
const { isAuthenticated } = useKindeBrowserClient();

return (
<Button variant="secondary" size="lg" asChild>
{isAuthenticated ? (
<Link href="/journal">Get Started</Link>
) : (
<LoginLink postLoginRedirectURL="/login/redirect">
Get Started
</LoginLink>
)}
</Button>
);
};
however when i am not logged in on the home page there is an error shown in the console.log is this intended behavior?, i just started my project and it already feels wrong haha (error is not shown if i am logged in)
✓ Compiled in 232ms (1085 modules)
Error: Cannot get user details, no authentication credential found
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:166:31)
at step (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:50:23)
at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:31:53)
at fulfilled (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:22:58)
Error: Cannot get user details, no authentication credential found
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@kinde-oss+kinde-typesc...
✓ Compiled in 232ms (1085 modules)
Error: Cannot get user details, no authentication credential found
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:166:31)
at step (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:50:23)
at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:31:53)
at fulfilled (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:22:58)
Error: Cannot get user details, no authentication credential found
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@kinde-oss+kinde-typesc...
1 Reply
onderay
onderay9mo ago
Might be an idea to check your setup against our NextJS Starterkit https://github.com/kinde-starter-kits/nextjs-starter-kit I will get a team member to look into this tomorrow for you
GitHub
GitHub - kinde-starter-kits/nextjs-starter-kit: Get up and going wi...
Get up and going with Kinde using NextJS. Contribute to kinde-starter-kits/nextjs-starter-kit development by creating an account on GitHub.
Want results from more Discord servers?
Add your server