supabase authentication for nextjs 14 in app/api
Unanswered
Broad-snouted Caiman posted this in #help-forum
Broad-snouted CaimanOP
following this guide -> https://supabase.com/docs/guides/auth/server-side/nextjs
I am not able to authenticate users in my app/api calls.
I guess this makes sense... it is a public api after all.
But is there a way to track a signed in supabase user making a call to the same server?
Or what is the recommended way of authenticating users using the nextjs api?
I am not able to authenticate users in my app/api calls.
I guess this makes sense... it is a public api after all.
But is there a way to track a signed in supabase user making a call to the same server?
Or what is the recommended way of authenticating users using the nextjs api?
import {
isAuthUser
} from '@/utils/auth/authUtils.js';
import {
createClient
} from '@/utils/supabase/server.js';
import {
cookies
} from 'next/headers';
import {
NextResponse
} from 'next/server';
export async function POST( req ) {
const cookieStore = cookies();
const supabase = createClient( cookieStore );
const auth = await supabase.auth.getUser();
...