Update user metadata

I’m trying to update user metadata, but I’m getting an error. Does anyone know how to resolve?

Hi @Ewerton :wave:

Did you login as that user before trying to update their metadata?

I think you might get that error if you are not logged in and trying to update the metadata of an existing user.

1 Like

Hi @Joyce ,

I want the manager to be able to change user data. That’s not possible?

In the weweb editor this is possible, including changing his password.

How can I do this?

Ah ok, got it!

So it’s possible but requires a bit of work.

For security reasons, Supabase protects the users table in the auth schema and doesn’t make it accessible via API.

To satisfy your use case, they recommend creating a profiles table in the public schema (this is the schema where you have most of your tables and that you can access through WeWeb’s Supabase data source plugin).

Then you can use triggers to keep both the private users and public profiles table in sync.

I’m working on a tutorial to explain how to do this. It should be out this week.

Not sure about changing another user’s password part though. I’ll need to look into that. In the WeWeb editor it’s possible because you have the Supabase Auth plugin installed which gives you writing access to that private users table.

1 Like

I understood. Only through the trigger then.

I will try to create one.

Thanks! :slight_smile:

1 Like