Custom Action. is undefined

I’m adding a custom action to include the user email in the access token claims. Adding data to claims works fine. But for some reason the email property in the action event is undefined. Could it be related to the fact that the user hasn’t verified their email address?

exports.onExecutePostLogin = async (event, api) => {
api.accessToken.setCustomClaim(“verified”, event.user.email_verified) // false
api.accessToken.setCustomClaim(“email”, // undefined

Solved-ish: When attaching the event.user as “user” to the claims, the full user data shows up correctly in the resulting access token. But when specifying individual properties such as The result does not show up in the token. I am unsure why this is, but I am able to work with this approach

1 Like

Hey there welcome to the community!

Good to know you were able to find a valid workaround :slight_smile: If you’d like to include the email claim directly with in access tokens I believe adding the email scope to however you are kicking off the /authorize request should do the trick. In auth0-react for example this would be in the AuthorizationParams:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.