# Problems with postlogin actions

**URL:** <https://community.auth0.com/t/problems-with-postlogin-actions/107733>\
**Category:** Get Help\
**Tags:** signup-prompt-new-experience, login-experience\
**Created:** [May 24, 2023, 5:05pm UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733 "2023-05-24T17:05:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugo127sanchez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hugo127sanchez/32/47506_2.png) [@hugo127sanchez](https://community.auth0.com/u/hugo127sanchez)\
**Post date:** [May 24, 2023, 5:05pm UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/1 "2023-05-24T17:05:09Z")

</div>

I have a problem. I want my users to register to be redirected to an additional information page. I think the only way to do this is by using a post login action  
this is my action

```auto
exports.onExecutePostLogin = async(event, api) => {
  if(event.stats.logins_count === 1){
    api.redirect.sendUserTo("http://localhost:5173/Additional-information")
  } else{
  }
};

```

I need that if the user starts a section, he returns to the page where he was before. How can I do that?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 25, 2023, 12:23am UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/3 "2023-05-25T00:23:54Z")

</div>

Hi @hugo127sanchez.

Welcome to the Auth0 Community!

I understand that you’ve been experiencing some difficulty with getting a Redirect Action to work in a Post Login Action script.

After reviewing your script, I noticed that there’s a missing code snippet that is necessary for resuming authentication from your redirect URL. It’s an important step, so let me guide you through it.

In your code, you will need to include the `onContinuePostLogin` function. Please take a look at the updated script below:

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (event.stats.logins_count === 1) {
    api.redirect.sendUserTo("http://localhost:5173/Additional-information");
  }
};

exports.onContinuePostLogin = async (event, api) => {
  // Add any necessary code here for resuming authentication
};

```

Then to return the user back to your application and resume the login transaction, you must take the `state` parameter that was appended in your redirect URL and pass it back to your `/continue` endpoint.

Here’s how the flow should look like:

1. The user logs in to your application.
2. They get redirected to your additional information page with a `state` parameter.
3. After the user completes adding the required information, you should send them back to the `/continue` endpoint. For example: `https://{yourAuth0Domain}/continue?state=THE_ORIGINAL_STATE`

For more detailed information, I recommend referring to our documentation on [Redirect Actions](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions). It provides additional insights that can be helpful in understanding the process.

Please let me know if you have any questions.

Thanks,

Rueben

---

<div class="post-metadata">

**Author:** ![hugo127sanchez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hugo127sanchez/32/47506_2.png) [@hugo127sanchez](https://community.auth0.com/u/hugo127sanchez)\
**Post date:** [May 25, 2023, 1:16am UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/4 "2023-05-25T01:16:02Z")

</div>

Hi, good morning, Ruben. In the end I decided to use the loginWithRedirect function. Since I do not understand the use of the actions well, since when after registering or logging in with any of those users, it does not let me make any authentication request. I think the problem is because when using my action at no time after the registrar does my app go through the /consent. I have doubts about how to use the loginWithRedirect to have two redirect\_uri one for the singup and another for the login. but for this I made another topic. Thank you very much for answering and sorry for the inconvenience

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 25, 2023, 6:01pm UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/6 "2023-05-25T18:01:45Z")

</div>

Hi @hugo127sanchez,

Thank you for your reply.

> [@hugo127sanchez](#):
>
> I have doubts about how to use the loginWithRedirect to have two redirect\_uri one for the singup and another for the login.

Unfortunately, it is not possible to use the `loginWithRedirect` function with two `redirect_uri` URLs.

Once the sign-up process is completed, the user is automatically logged in, and there is no distinction between the two actions in terms of redirecting to different pages. The `loginWithRedirect` function is designed to accept only one `redirect_uri` value as a string for the authorization parameter.

I hope this explanation clears up any confusion!

I also noticed that you have created a new post regarding [this issue here](https://community.auth0.com/t/problems-with-user-authentication-after-registration/107806), and I will continue the discussion there to provide further assistance.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![hugo127sanchez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hugo127sanchez/32/47506_2.png) [@hugo127sanchez](https://community.auth0.com/u/hugo127sanchez)\
**Post date:** [May 25, 2023, 6:25pm UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/7 "2023-05-25T18:25:14Z")

</div>

> [@rueben.tiow](#):
>
> Unfortunately, it is not possible to use the `loginWithRedirect` function with two `redirect_uri` URLs.
> 
> Once the sign-up process is completed, the user is automatically logged in, and there is no distinction between the two actions in terms of redirecting to different pages. The `loginWithRedirect` function is designed to accept only one `redirect_uri` value as a string for the authorization parameter.
> 
> I hope this explanation clears up any confusion!
> 
> I also noticed that you have created a new post regarding [this issue here](https://community.auth0.com/t/problems-with-user-authentication-after-registration/107806), and I will continue the discussion there to provide further assistance.

thank you! Yes, in the end I managed to do as you indicated but I have another problem with the getAccessTokenSilently when registering. That’s why there was the other thread. again thank you very much for your attention

---

<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:** [June 8, 2023, 6:26pm UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/8 "2023-06-08T18:26:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [May 14, 2024, 2:10pm UTC](https://community.auth0.com/t/problems-with-postlogin-actions/107733/9 "2024-05-14T14:10:59Z")

</div>

Hey team!

This topic seems related to our new EA feature, Forms for Actions, which rolled out of the beta stage on May 7th. Our Product team prepared the whole Documentation page with examples of Use cases. [Forms for Actions](https://auth0.com/docs/customize/forms). If you find yourself having questions regarding this new feature for the next two weeks, we are hosting an [Ask Me Anything session](https://community.auth0.com/t/auth0-community-ask-me-anything-customize-and-extend-ciam-with-new-forms-for-actions/133516). Our Product Expert will provide comprehensive written answers on May 21st from 8 AM to 10 AM PST.  
Find out more about [Forms for Actions](https://auth0.com/docs/customize/forms) and [learn more about AMA](https://community.auth0.com/t/auth0-community-ask-me-anything-customize-and-extend-ciam-with-new-forms-for-actions/133516).

Thanks!  
Dawid
