NextJS API with non-NextJS Queries

Is it possible to accept queries to the NextJS API that uses createRouteHandlerClient in "@supabase/auth-helpers-nextjs";?

I ask because I want to authenticate users but currently the only way is via cookies, and I'm not sure how to send cookies from, say, a React Native application, in the format auth-helpers-nextjs expects them.

This is the current way I accept the request in NextJS, how can I confirm a user is a who they claim to be from within this same setup so I can re-use this API from another client?

export async function GET(req) {

  const cookieStore = cookies();
  const supabase = createRouteHandlerClient({ cookies: () => cookieStore });

  const {
    data: { session },
  } = await supabase.auth.getSession();

  let currentUser = session?.user;
  if (currentUser) {
....
}...
Was this page helpful?