Auth0 actions api not defined

Hi Everyone,
One newbie question regarding the usage of Action:
Here is the code I have:
exports.onExecutePostUserRegistration = async (event, api) => {
api.user.setUserMetadata(“registeredPolicy”, “NO”);

What should I do to define api?
Test Results
“message”: “Cannot read property ‘user’ of undefined”,
“name”: “TypeError”

I see onExecutePostUserRegistration doesn’t have api


I understand you have trouble getting custom Actions to work.

Having looked closely at your custom action script, it appears that you are using a Post User Registration action. Unfortunately, it’s not possible to enrich the user’s profile’s metadata post user registration.

In this case, I recommend enriching the user’s profile using a Post Login trigger instead. The Post Login Action will allow you to accomplish your desired behavior.

Please let me know if you have any questions. I would be happy to help.

Thank you @rueben.tiow
One quick question please, I am using Owin Quick Start guide for and I need to update the user app_metadata from code and not from Rules/Actions.
Could you provide me any links or guides in order to do so? Thanks

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