Post Registration Action - app.redirect is undefined

Hi all,
I’m trying to implement the flow described here:

My code

exports.onExecutePostUserRegistration = async (event, api) => {
  const YOUR_AUTH0_DOMAIN = event.secrets.YOUR_AUTH0_DOMAIN || event.request.hostname

  console.log("## API REDIRECT", api.redirect) // <-- undefined

  // Craft a signed session token
  const token = api.redirect.encodeToken({
    secret: event.secrets.TOKEN_SECRET,
    expiresInSeconds: 60, 
    payload: {
      // Custom claims to be added to the token
      auth0_user_id: event.user.user_id,
      continue_uri: `https://${YOUR_AUTH0_DOMAIN}/continue`

  // Send the user to along
  // with a `session_token` query string param including
  // the email.
  api.redirect.sendUserTo(`${event.secrets.BASE_URL}/registration`, {
    query: { session_token: token }

However, app.redirect is always undefined.
Any help is truly appreciated

Hi @pascal2,

The api.redirect object is not available in Post User Registration Actions. You must use a Post Login Action.

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