# Self hosted login widget and MFA not returning after call to showSignInToGetTokens

**URL:** <https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580>\
**Category:** Questions\
**Tags:** widget\
**Created:** [November 28, 2022, 2:05pm UTC](https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580 "2022-11-28T14:05:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![whitemtnelf](https://avatars.discourse-cdn.com/v4/letter/w/dc4da7/32.png) [@whitemtnelf](https://devforum.okta.com/u/whitemtnelf)\
**Post date:** [November 28, 2022, 2:05pm UTC](https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580/1 "2022-11-28T14:05:30Z")

</div>

We are using v7 of the Okta Login Widget. The following code makes the ajax call to our Login controller when the user account doesn’t have MFA enabled. However, when MFA is enabled the code doesn’t return to where we do the ajax call. How do I either get the code to return so that the ajax call is made, or is there another option?

```auto
 function (error) {
            oktaSignIn.showSignInToGetTokens({
                el: '#okta-login-container'
            }).then(function (tokens) {
                oktaSignIn.authClient.tokenManager.setTokens(tokens);
                oktaSignIn.remove();

                var data = {
                    accessToken: tokens.accessToken.accessToken,
                    idToken: tokens.idToken.idToken
                };

                $.ajax({
                    type: "POST",
                    url: "/Login/SubmitLogin",
                    data: addAntiForgeryToken(data)
                })
                .done(function (response) {
                    window.location = response.RedirectUrl;
                })
                .fail(function (response) {
                    global.AjaxFailedRedirect(response);
                });

            }).catch(function (err) {
                console.error(err);
            });
        });type or paste code here

```

---

<div class="post-metadata">

**Author:** ![gpadma](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gpadma](https://devforum.okta.com/u/gpadma)\
**Post date:** [November 28, 2022, 10:57pm UTC](https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580/2 "2022-11-28T22:57:29Z")

</div>

Hi @whitemtnelf,

Do you have App level MFA policies configured ? Are you using Okta Classic Engine or Okta Identity Engine ?

---

<div class="post-metadata">

**Author:** ![whitemtnelf](https://avatars.discourse-cdn.com/v4/letter/w/dc4da7/32.png) [@whitemtnelf](https://devforum.okta.com/u/whitemtnelf)\
**Post date:** [November 28, 2022, 11:15pm UTC](https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580/3 "2022-11-28T23:15:05Z")

</div>

We’re using Identity Engine. For testing MFA I use the provided ‘Any Two Factors’ authentication policy and assign it to my app.

---

<div class="post-metadata">

**Author:** ![whitemtnelf](https://avatars.discourse-cdn.com/v4/letter/w/dc4da7/32.png) [@whitemtnelf](https://devforum.okta.com/u/whitemtnelf)\
**Post date:** [November 29, 2022, 9:22pm UTC](https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580/4 "2022-11-29T21:22:46Z")

</div>

I was wrong and it is working correctly. Please delete this post.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [November 30, 2022, 9:23pm UTC](https://devforum.okta.com/t/self-hosted-login-widget-and-mfa-not-returning-after-call-to-showsignintogettokens/22580/5 "2022-11-30T21:23:06Z")

</div>

Closed on November 30, 2022, 9:23pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
