Profile Pre-filling from External IdP
Automatically pre-fill user data
You can use a ZITADEL action if you want to prefill the fields specific fields like firstname, lastname and email verified with your providers data.
- Go to the users target organizations settings page.
- Add a new action with the body below. Make sure the action name equals the scripts function name. Also change the id in the script to match your provider settings id.
- Add the action to the flow "External Authentication" and trigger it on "Post Authentication"
This action is an example for OKTA. You can also use it for any other provider
/** * Set first and lastname of a user on just in time provisioning for okta. * Useful if you like to fill the first and lastname with the name stored on okta, so the user doesn't have to fill himself. * Also set email to verified, so the user doesn't get a verification email * * Flow: External Authentication, Trigger: Post Authentication * * @param ctx * @param api */let logger = require("zitadel/log")function mapOktaOauth(ctx, api) { logger.log('Populating extra information for new Okta user'); if (ctx.v1.externalUser.externalIdpId != "your-idp-id") { return } api.setFirstName(ctx.v1.providerInfo.name); api.setLastName(ctx.v1.providerInfo.name); api.setEmailVerified(true) api.setEmail(ctx.v1.providerInfo.email) api.setPreferredUsername(ctx.v1.providerInfo.preferred_username)}Was this page helpful?