I am trying to figure out how to properly use actions set from organization settings "Actions" tab. In particular, I am setting up a post external authentication action to remap SAML response attributes from an external IdP as attributes for user creation/update. I used the example code provided in the zitadel repo:
function map(ctx, api) { if (ctx.v1.externalUser.externalIdpId != "your_external_idp") { return } // the attribute names below represent the crewjam IDP example, be sure to update them to match your provider info let firstname = ctx.v1.providerInfo.attributes["urn:oid:2.5.4.42"]; let lastname = ctx.v1.providerInfo.attributes["urn:oid:2.5.4.4"]; let email = ctx.v1.providerInfo.attributes["urn:oid:1.3.6.1.4.1.5923.1.1.1.6"]; let displayname = ctx.v1.providerInfo.attributes["urn:oid:2.5.4.3"]; let username = ctx.v1.providerInfo.attributes["urn:oid:0.9.2342.19200300.100.1.1"]; if (firstname != undefined) { api.setFirstName(firstname[0]); } if (lastname != undefined) { api.setLastName(lastname[0]); } if (email != undefined) { api.setEmail(email[0]); api.setEmailVerified(true); } if (displayname != undefined) { api.setDisplayName(displayname[0]); } if (username != undefined) { api.setPreferredUsername(username[0]); } }
but I still can't get it to work properly. Trying to debug/see what is wrong with this I noticed there is no action runtime log for actions in Zitadel cloud. I also tried performing an http request sending as POST body whatever info I wanted but it still didn't work. I searched the documentation but there doesn't seem to be anything more than references to the examples. What am I missing? Are these actions v1 or v2? what is the optimal way to debug or test an action?