# Widget not recognizing previous partial authentication challenge

**URL:** <https://devforum.okta.com/t/widget-not-recognizing-previous-partial-authentication-challenge/13727>\
**Category:** Questions\
**Tags:** dotnet, widget\
**Created:** [April 9, 2021, 4:34pm UTC](https://devforum.okta.com/t/widget-not-recognizing-previous-partial-authentication-challenge/13727 "2021-04-09T16:34:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![efinch](https://avatars.discourse-cdn.com/v4/letter/e/b3f665/32.png) [@efinch](https://devforum.okta.com/u/efinch)\
**Post date:** [April 9, 2021, 4:34pm UTC](https://devforum.okta.com/t/widget-not-recognizing-previous-partial-authentication-challenge/13727/1 "2021-04-09T16:34:49Z")

</div>

I am having trouble getting a particular scenario to work. I discovered the samples-aspnet-master\self-hosted-login example, and it exhibits the same problem behavior. My application is [ASP.Net](http://ASP.Net) MVC 5 (.Net 4.8). What can I do to achieve the “Desired behavior” with the steps below?

Steps to reproduce in the samples-aspnet-master\self-hosted-login example:

1. I open the browser and log into our Okta domain, which requires username/password, but not MFA.

2. I navigate to the sample application’s Home/Profile route, which requires authentication.

3. Because my website requires MFA, it recognizes that I am not properly authenticated and the website redirects me to the local Account/Login route that hosts the widget.

4. At this point the problem occurs  
a) Desired behavior: The widget should recognize that I already provided my username/password from when I logged into the Okta domain and should forward me to the MFA screen.

b) Actual behavior: The widget displays the username/password challenge, even though I already supplied that when I logged into the Okta domain.

The widget code in the example looks like this:

signIn.renderEl({ el: ‘#widget’ }, (res) =\> {  
var sessionTokenField = $("#hiddenSessionTokenField");  
sessionTokenField.val(res.session.token);  
var form = sessionTokenField.parent();  
form.submit();  
}, (err) =\> {  
console.error(err);  
});

I am wondering if the widget code should look more like this other example, but when I tried this, it did not work.

oktaSignIn.session.get(function (res) {  
// Session exists, show logged in state.  
if (res.status === ‘ACTIVE’) {  
var url = $("#RedirectTo").val();  
location.href = url;  
return;  
}  
// No session, or error retrieving the session. Render the Sign-In Widget.  
else if (res.status === ‘INACTIVE’) {

```
    oktaSignIn.renderEl(
        { el: '#okta-login-container' },
        function (res) {
            if (res.status === 'SUCCESS') {
                console.log('User %s succesfully authenticated %o', res.user.profile.login, res.user);
                res.session.setCookieAndRedirect(window.location.origin);
            }
        }
    );
    return;
}
else {
    alert(res.status);

}

```

});

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 6, 2024, 11:25pm UTC](https://devforum.okta.com/t/widget-not-recognizing-previous-partial-authentication-challenge/13727/2 "2024-02-06T23:25:55Z")

</div>

Closed on February 6, 2024, 11:25pm UTC


