VeryGingerBear
VeryGingerBear
KKinde
Created by VeryGingerBear on 9/14/2024 in #💻┃support
next.js server => api
Switched to Clerk and solved the issue in a total of 10 minutes. Switch included.
10 replies
KKinde
Created by VeryGingerBear on 9/14/2024 in #💻┃support
next.js server => api
Two messages above? Can’t you see that message?
10 replies
KKinde
Created by VeryGingerBear on 9/14/2024 in #💻┃support
next.js server => api
I tried adding debug, other than that I think the code above is pretty close?
10 replies
KKinde
Created by VeryGingerBear on 9/14/2024 in #💻┃support
next.js server => api
Hi, I'm using the Next.js SDK, "@kinde-oss/kinde-auth-nextjs": "^2.3.6" I'm using App Router. I am doing a fetch request from my server component, which is able to get the authenticated user.
const { isAuthenticated } = getKindeServerSession();
const isAuth = await isAuthenticated();
//User is authenticated here.
if (!isAuth) {
return null;
}

const events = await getEvents();
const { isAuthenticated } = getKindeServerSession();
const isAuth = await isAuthenticated();
//User is authenticated here.
if (!isAuth) {
return null;
}

const events = await getEvents();
In the API route that this fetch call goes to I do not get a user.
export async function GET(req: NextRequest) {
const { getUser, isAuthenticated } = getKindeServerSession(req);
const isAuth = await isAuthenticated();
const user = await getUser();
export async function GET(req: NextRequest) {
const { getUser, isAuthenticated } = getKindeServerSession(req);
const isAuth = await isAuthenticated();
const user = await getUser();
I haven't found documentation on how the fetch request should be structured, if the Bearer token should be passed explicitly or not etc.
10 replies