I am trying to create a user via a POST request with Python. The user is created and all of the user’s data is correct except the app_metadata is missing. I am wondering if I am using the API incorrectly or if it is even possible to add app_metadata on user registration. If there are any alternate ways to add app_metadata through Python I would love to know those as well! Here is the current code for the request:
As @rashid779939 said, with the Authentication API you can only set the user_metadata.
If you need to set app_metadata, that would need to be done via Management API (which is never called on behalf of an end user but of an administrator). Note though that you could also consider setting the app_metadata in a post-user-registration hook.
It depends on the use case and business logic which field makes most sense to you.
See the difference here:
User metadata : stores user attributes such as preferences that do not impact a user’s core functionality. Logged in users can edit their data stored in user_metadata if you build a form for them using the Management API PATCH endpoint with the scope update:current_user_metadata .
App metadata : stores information (such as, support plan subscriptions, security roles, or access control groups) that can impact a user’s core functionality, such as how an application functions or what the user can access. Data stored in app_metadata cannot be edited by users. See App metadata restrictions for what cannot be stored in this field.