In this guide, you will create a ZITADEL action. After users register using an external identity provider, the action assigns them a role.
Before you start, make sure you have everything set up correctly.
- You need to be at least a ZITADEL ORG_OWNER
- Your ZITADEL organization needs to have the actions feature enabled.
- Your ZITADEL organization needs to have at least one external identity provider enabled
- You need to have at least one role configured for a project
Copy some information for the action
- Select the Projects navigation item.
- Select a project that has a role configured.
- Copy the projects Resource Id on the screens top right.
- Scroll to the ROLES section and note some roles key.
Create the action
- Select the Actions navigation item.
- In the Actions section, select the + New button.
- Give the new action the name
- Paste this snippet into the multiline textfield.
- Replace the snippets placeholders and select Save.
Run the action when a user registers
Now, make the action hook into the external authentication flow.
- In the Flows section, select the + New button.
- Select the Flow Type External Authentication.
- Select the Trigger Type Post Creation.
- In the Actions dropdown, check addGrant.
- Select the Save button.
New users automatically are assiged a role now if they register by authenticating with an external identity provider.