This article explains how to capture application context, such as the application's Client ID and name, during the password reset flow. By default, the Okta Sign-In Widget does not display this application information on the password reset page. This guide provides the sample code necessary to access these details.
- Okta Hosted Sign-in Widget
- Okta Identity Engine (OIE)
- Password Reset
The Okta Sign-In Widget does not display application information during the password reset flow. The application context can be captured programmatically using the afterRender event hook, the password-reset context controller, and the ApplicationContext object from OktaUtil.
Implement the following code to capture the application details. This script listens for the afterRender event, checks if the context is the password-reset page, and then retrieves the application context.
// Remove this if it already exists
var config = OktaUtil.getSignInWidgetConfig();
var oktaSignIn = new OktaSignIn(config);
oktaSignIn.on('afterRender', function (context) {
// Check if the current view is the forgot-password page in the Sign-In Widget
if (context.controller === "forgot-password") {
// Get the application context, such as ID, name, and label
var appContext = OktaUtil.getRequestContext().app.value;
// Add custom logic using the application context available in the appContext object.
}
});
Example of Application Context object returned in the response from Okta.
Related References
To learn more about the afterRender event, see the Okta Sign-In Widget Documentation.
To learn more about the request context, see the Okta Request Context Documentation.
