Zitadel action user register
Hi, I want to use a Zitadel Action to add a user role automatically after registration. I configured my setup according to this guide:
https://zitadel.com/docs/guides/manage/customize/behavior
The project is granted to the default organization. I used "Internal Authentication" as a Flow Type and the name of the action "addGrant" is the same as the function name.
However, when I register I get:
rawMessage":"Errors.User.GrantRequired
ZITADEL Docs
In this guide, you will create a ZITADEL action.

19 Replies
hey @Lucho thanks for your question and welcome to the server, may I know what version are you on (upper right default settings) and do you already have a role
ORG_OWNER added?Hi @Rajat, thank you.
Version v4.2.2 and I also added another ORG_OWNER.

hey @Lucho did anything changed after adding org_owner?
No, unfortunately not:
"error":{"name":"ConnectError","rawMessage":"Errors.User.GrantRequired..
Any idea how I can debug this? Maybe I use the wrong project/resourceId?
hey @Lucho pls check if your projecttID that you are passing in the action matches with the correct actual project
In the placeholder it states:
projectID: '<the projects resource ID>',
so I assume I have to put the resource ID of the project, which I did.
It is a granted project. Do I have to define the action at the project host or at the organization level?
hey @Lucho good morning, I just tried running this action and it seems to work!
this is my script
the
projectID is the Resource Id mentioned when you click on your project.
And the role already existed under roles.
I set it under external auth->post creation trigger.
Please lmk if this helps


@Rajat Thank you for the detailed explanation! WHat is configured in the postAuth function?
hey @Lucho that is a seprate action that I wrote, unrelated to this question 😅
@Rajat Should it work the same with Internal Authentication?
yes it will
Hi Rajat, it is still not working. I also found out that the email verify step is not triggered after I set a password.
hey @Lucho if you are using the built in SMTP, that wont work.
Its only for testing purposes you may have to setup your own SMTP.
we use our own

also the test is working and I receive emails but when i do the registration I get an unknown error

hey @Lucho thanks for conforming, seems like a slow SMTP pipeline, I am checking with the team.
Thanks. I am wondering how I can even login without confirming the email address. I thought this step is mandatory for new users
hey @Lucho you can update a user and mark its email as verified via the API for now and that should bypass the email verification for now,.
Oh sorry, for the confusion. I don't want to skip the email verification. It just looked that the email verification was skipped and the user could login directly.
But we had different versions of zitadel login and zitadel db which might confused the system... I will try again