supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

List all users (auth schema) not working with local environment

Open Tahaaskari97 opened this issue 1 year ago • 2 comments

When attempting to load all users from the auth schema using the provided code snippet, the expected behavior is to fetch users from the Supabase environment. However, it appears that the code functions properly in the production environment but fails to retrieve users in the local environment.

useEffect(() => {
    const getUsers = async () => {
      const {
        data: { users },
        error,
      } = await supabase.auth.admin.listUsers();
    console.log({ users });
    };
    getUsers();
  }, []);

Upon investigation, the code block utilizing await supabase.auth.admin.listUsers() is intended to fetch users. However, in the local environment, it does not yield the expected results.

Tahaaskari97 avatar Apr 03 '24 21:04 Tahaaskari97

Are you using "service_role" key or just "anon"?

Tananga avatar Apr 09 '24 13:04 Tananga

Are you using "service_role" key or just "anon"?

@Tananga yes I am using service_key_role

Tahaaskari97 avatar Apr 15 '24 12:04 Tahaaskari97