# Post Registration Action - app.redirect is undefined

**URL:** <https://community.auth0.com/t/post-registration-action-app-redirect-is-undefined/115391>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [September 5, 2023, 3:34am UTC](https://community.auth0.com/t/post-registration-action-app-redirect-is-undefined/115391 "2023-09-05T03:34:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pascal2](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@pascal2](https://community.auth0.com/u/pascal2)\
**Post date:** [September 5, 2023, 3:34am UTC](https://community.auth0.com/t/post-registration-action-app-redirect-is-undefined/115391/1 "2023-09-05T03:34:13Z")

</div>

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

> **[Redirect with Actions](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions)**
>
> Learn how to use post-login Actions to redirect users before an authentication transaction is complete.

My code

```auto
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
      email: event.user.email,
      auth0_user_id: event.user.user_id,
      continue_uri: `https://${YOUR_AUTH0_DOMAIN}/continue`
    },
  });

  // Send the user to https://my-app.exampleco.com 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  
Pasca

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 7, 2023, 8:00pm UTC](https://community.auth0.com/t/post-registration-action-app-redirect-is-undefined/115391/3 "2023-09-07T20:00:20Z")

</div>

Hi @pascal2,

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

> **[Redirect with Actions](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions?_gl=1*1ia4d9s*_gcl_au*MTAzMDMyMTM4Ny4xNjg5MTkxMTUw)**
>
> Learn how to use post-login Actions to redirect users before an authentication transaction is complete.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [September 21, 2023, 8:01pm UTC](https://community.auth0.com/t/post-registration-action-app-redirect-is-undefined/115391/4 "2023-09-21T20:01:04Z")

</div>

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