Resuming journeys using magic links in JavaScript
PingOne Advanced Identity Cloud PingAM JavaScript
When the user clicks the magic link in their email, it launches your JavaScript login UI app in their browser.
|
If the magic link doesn’t open your JavaScript login app, ensure you have correctly configured your server’s External Login Page URL property. Learn more in Configuring servers for suspended authentication. |
Contained within the magic link is the unique suspendedID parameter, which allows the server to resume the authentication journey, and restore any state it has captured so far.
Use the Journey client’s resume() method, rather than start(), to continue the journey. You must pass in the URI that contains the suspendedID parameter:
Resuming a journey in a JavaScript login app
const client = await journey({
config: {
serverConfig: {
wellknown: 'https://signon.example.com/.well-known/openid-configuration',
},
},
});
const url = new URL(window.location.href);
const urlHasSuspendedId = url.searchParams.get("suspendedId");
if (urlHasSuspendedId) {
// Resume existing journey, rather than starting a new one
let step = await client.resume(url);
}