<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
How To Capture Application Context During the Password Reset Flow in Sign-in Widget
Okta Classic Engine
Okta Identity Engine
API Access Management
Overview

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.

Applies To
  • Okta Hosted Sign-in Widget
  • Okta Identity Engine (OIE)
  • Password Reset 
Solution

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.

Context controller

 

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.

Loading
How To Capture Application Context During the Password Reset Flow in Sign-in Widget