Javascript Reference v1.0

Update the access token


function apiFunction(req, res) {
  // Assuming the access token was sent as a header "X-Supabase-Auth"
  const { access_token } = req.get('X-Supabase-Auth')

  // You can now use it within a Supabase Client
  const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key")
  const { user, error } = supabase.auth.setAuth(access_token)

  // This client will now send requests as this user
  const { data } = await supabase.from('your_table').select()
}