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.
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:
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.