JanJ
ZITADEL4mo ago
4 replies
Jan

How to programmatically activate users?

Following a migration to a new self-hosted Zitadel instance a lot of users are suddenly in "Initial" state (those who did not have a password set because they only had logged in via IdP).

I can't seem to find a way to programmatically get them out of this state. I've tried (all using Python and requests with both
Content-Type
and
Accept
set to
application/json
, similar to the code in the API documentation):

* PATCH /v2/users/human/<userid> with
{"human": {"email": "...", "isVerified": true } }
(result: 400 error,
proto: syntax error (line 1:11): unexpected token \\"<email>\\"
)
* PUT /v2/users/human/<userid> with
{"email": "...", "isVerified": true}
(result: 400 error,
proto: syntax error (line 1:11): unexpected token \\"<email>\\"
)
* PUT /management/v1/users/<userid>/email with
{"email": "...", "isEmailVerified": true}
(result: 400 error,
{"code":9, "message":"Användaren är ännu inte initialiserad (COMMAND-J8dsk)", "details":[{"@type":"type.googleapis.com/zitadel.v1.ErrorDetail", "id":"COMMAND-J8dsk", "message":"Användaren är ännu inte initialiserad"}]}
, translates to "The user is not yet initialised")

So - what is the correct way to get a user out of the initialization state via the API? And why did neither of my attempts above work?
Was this page helpful?