Signin widget post render action

Hi,
I would like to perform an action after the signing widget has been rendered.
I was expecting to use the RenderSuccessCallback parameter of the renderEl function but it is never invoked.
Example:

// Render the Okta Sign-In Widget
var oktaSignIn = new OktaSignIn(config);
oktaSignIn.renderEl({ el: '#okta-login-container' },
    //OktaUtil.completeLogin,
    function(res) {
        i_dont_arrive_here();
    },
    function(error) {
        // Logs errors that occur when configuring the widget.
        // Remove or replace this with your own custom error handler.
        console.log(error.message, error);
    }
);

The first callback function is not called after the widget rendering.

I suspect it will be called after the sign in process (hint: the original OktaUtil function is named completeLogin).

How can I add a post-render pre-signin action?

Thanks,

Gualtiero

BTW: if the render fails (for example, because the el target is missing), the RenderFailureCallback is also not invoked.

I’ve found a work-around using the “on” function:

var oktaSignIn = new OktaSignIn(config);
oktaSignIn.on('ready', () => { 
     // post rendering actions
});
oktaSignIn.renderEl({ el: '#okta-login-container' });

In this example, I removed the useless callback functions in the renderEl call.

Hello,

You can also register an after render handler which will be called each time a different Widget controller renders a screen.

Also after error if an error is encountered.

2 Likes