``` const { user: authUser } = await supabase.auth...
# help
m
Copy code
const { user: authUser } = await supabase.auth.api.getUserByCookie(req);
  // Check if the user is logged
  if (authUser === null) {
    // Redirect if no logged in
    return { props: {}, redirect: { destination: "/" } };
  }
  // If logged return the user
  let { user, error } = await supabase.from("users").select("id, first_name");
  console.log("user", authUser);
  if (user) {
    return { props: { user: user } };
  } else {
    return { props: {}, redirect: { destination: "/" } };
  }
I read on the supabase documentation that with the set policies I wouldn't need to filter and I could directly do .from("users") and get the relevant row from the public users table, with the primary key set as a foreign key to the auth.users table Note: authUser is returning the correct value.
n
Hello @msy! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
m
@garyaustin I created a new thread.
n
🆕 New Thread
n
🆕 into server side request and jwt token stuff
🆕 server side request and jwt token stuff
g
I don't do serverside stuff, but you might need to use setauth() after you get the token... https://supabase.com/docs/reference/javascript/auth-setauth
n
server side request and jwt token stuff