Post User Registration Flow API Object

Overview

Currently, the default template of the Post User Registration code is missing the api parameter. It is as follows:

/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
*/

exports.onExecutePostUserRegistration = async (event) => {
...
}

Solution

Here is how to define the api object in the Post User Registration Flow:

/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
* @param {PostUserRegistrationAPI} api - Details about the context and user that has registered.
*/
exports.onExecutePostUserRegistration = async (event, api) => {
...
}

The current usable functions in the api object are:

  • api.cache.get() - Get a cache item;
  • api.cache.set() - Set a cache item;
  • api.cache.delete() - Delete a cache item.