Testing onContinuePostLogin from Code Editor

Hello,

I’m developing a custom post login action and I’m wondering if there a way to test run the onContinuePostLogin method in the code editor. When I press run in the test sidebar it always runs the onExecutePostLogin method but haven’t found a way to test run onContinuePostLogin.

Appreciate the help. Thanks.

Hi @chris.gatzonis,

Welcome to the Auth0 Community!

I understand that you are looking to test a Redirect Action Flow, specifically with onContinuePostLogin.

To do this, you will need to perform a real login flow to get redirected to your redirect URL. Once that happens, the browser URL should contain a state query parameter, which you can take and append to the /continue endpoint in the browser.

For example:

/**
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
  api.redirect.sendUserTo("https://my-app.exampleco.com");
};

/**
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/

exports.onContinuePostLogin = async (event, api) => {
}

The user gets redirected to this URL with a randomly generated state value:

https://my-app.exampleco.com/?state=stateABC123

Then you can take the state and append it to the /continue endpoint and paste it into the browser URL with the following format:

https://{{your_domain}}/continue?state=stateABC123

Doing so completes the authentication flow and brings the user back to the correct callback URL of your application.

I hope the explanation was clear!

Please let me know how this goes for you.

Thanks,
Rueben

Thanks rueben.tiow. I was hoping that I could test it directly from the code editor same way I can test onExecutePostLogin from the sidebar but I understand that there is no option for that.

1 Like

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