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
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:
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:
The user logs in to your application.
They get redirected to your additional information page with a state parameter.
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. It provides additional insights that can be helpful in understanding the process.
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
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, 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
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. If you find yourself having questions regarding this new feature for the next two weeks, we are hosting an Ask Me Anything session. 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 and learn more about AMA.