pbechlivP
ZITADEL10mo ago
4 replies
pbechliv

How to programmatically activate a user through the API

I am struggling with a problem currently, which is the following:

I have the option to create a user with emailVerified and password to set him as Activated.
But
If I don't create a user already as activated...I find no way to programmatically Activate a user and set his/her password from the API.

I have tried the following:
Try to programmatically go through the invitation process
v2/users/:userId/invite_code - I get "User is already initialized (COMMAND-EF34g)"
Try to initiate v2 password change by getting returnCode in the API
v2/users/:userId/password_reset - "User is not yet initialized (COMMAND-Sfe4g)" (The opposite error of the above for the same user with the same state)
Try to set the initial password from the v1 API
/management/v1/users/:userId/password/_initialize - "User is not yet initialized (COMMAND-M9dse)"
Try to set the password from the v1 API
/management/v1/users/:userId/password - "User is not yet initialized (COMMAND-M9dse)"

I even saw that there is a /resources/v3alpha/users/{id}/_activate options but I haven't tested it as I wouldn't want to use an experimental endpoint that might break

Please I would appreciate any help this topic, as I seem to be out of options
Was this page helpful?