# Okta Sign-in Widget does nothing with token

**URL:** <https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023>\
**Category:** OAuth/OIDC\
**Created:** [September 29, 2022, 4:36pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023 "2022-09-29T16:36:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxa](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxa](https://devforum.okta.com/u/jxa)\
**Post date:** [September 29, 2022, 4:36pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/1 "2022-09-29T16:36:56Z")

</div>

I am having a similar issue as this user: [Okta Sign In widget not Working outside localhost](https://devforum.okta.com/t/okta-sign-in-widget-not-working-outside-localhost/14187)

My app is set up as specified in this guide: [Sign in to your SPA with the embedded Okta Sign-In Widget | Okta Developer](https://developer.okta.com/docs/guides/sign-in-to-spa-embedded-widget/react/main)

The only difference is in onSuccess on the login page I added a console.log to do some debugging. It never gets fired, which leads me to believe the issue is in the widget.

It was previously working even without HTTPS, but now the sign-in just hangs - I am not sure why. I see a POST to https://.okta.com/api/v1/authn that succeeds and responds with a sessionToken. The Sign-in widget promise never hits onSuccess or onError.

These are the package versions:

```auto
    "@okta/okta-auth-js": "^6.5.4",
    "@okta/okta-react": "^6.6.0",
    "@okta/okta-signin-widget": "^6.7.1",
    "react-dom": "^18.1.0",
    "react-router-dom": "^5.3.3",
    "react-scripts": "^5.0.1",

```

It hangs on this screen, with the circle endlessly spinning in mockery:  
 ![firefox_qXXHAwUzOt](https://global.discourse-cdn.com/oktadev/original/2X/9/98299a51195f2a4903d4f9bcfecef1d5b22f80c9.png)

---

<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:** [September 30, 2022, 8:24pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/2 "2022-09-30T20:24:17Z")

</div>

Which method are you calling to load the widget?

---

<div class="post-metadata">

**Author:** ![jxa](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxa](https://devforum.okta.com/u/jxa)\
**Post date:** [October 4, 2022, 5:52pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/3 "2022-10-04T17:52:15Z")

</div>

We’re calling `widget.showSignInToGetTokens`

---

<div class="post-metadata">

**Author:** ![jxa](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxa](https://devforum.okta.com/u/jxa)\
**Post date:** [November 7, 2022, 9:32pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/4 "2022-11-07T21:32:12Z")

</div>

We’ve moved to hosting on HTTPS to make sure there’s no issue there but we still have the same problem

---

<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:** [November 8, 2022, 4:33pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/5 "2022-11-08T16:33:20Z")

</div>

Do you not do anything after showSignInToGetTokens succeeds? You’ll need to make sure you store the tokens AND hide the widget, as this method was designed for SPAs that do not want to redirect away to another route.

Can you try modelling your widget code like [our sample](https://d28m3l9ryqsunl.cloudfront.net/docs/guides/sign-in-to-spa-embedded-widget/angular/main/#sample-application-code) below:

```auto
      el: '#sign-in-widget',
      scopes: sampleConfig.oidc.scopes
    }).then((tokens: Tokens) => {
      // Remove the widget
      this.signIn.remove();

      // In this flow the redirect to Okta occurs in a hidden iframe
      this.oktaAuth.handleLoginRedirect(tokens);
    }).catch((err: any) => {
      // Typically due to misconfiguration
      throw err;
    });
```

---

<div class="post-metadata">

**Author:** ![jxa](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxa](https://devforum.okta.com/u/jxa)\
**Post date:** [November 8, 2022, 9:30pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/6 "2022-11-08T21:30:56Z")

</div>

That code is for angular, but our OktaSignInWidget.jsx is already an exact copy of the React version of the linked sample.

The weird part about this is the sign-in stopped working without any code changes. I’ve checked a few times to make sure our code is 100% lined up with the samples and it is, so I really can’t figure out what is going wrong.

---

<div class="post-metadata">

**Author:** ![umeshvenkat](https://avatars.discourse-cdn.com/v4/letter/u/779978/32.png) [@umeshvenkat](https://devforum.okta.com/u/umeshvenkat)\
**Post date:** [January 13, 2023, 11:05am UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/7 "2023-01-13T11:05:37Z")

</div>

Got any solution for this problem. I am also stuck at the same situation.

---

<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 22, 2023, 8:51pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/9 "2023-02-22T20:51:23Z")

</div>

@umeshvenkat As you might be experiencing a different issues from the original poster, please open another thread or, if you have a paid account, [a support case](https://support.okta.com/help/s/article/How-to-Create-a-Support-Case?language=en_US) to get assistance.

---

<div class="post-metadata">

**Author:** ![Sid303](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Sid303](https://devforum.okta.com/u/Sid303)\
**Post date:** [March 20, 2023, 2:00pm UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/10 "2023-03-20T14:00:13Z")

</div>

For me the password policy was not set properly which is why I was not getting the token.

---

<div class="post-metadata">

**Author:** ![himanshu123](https://avatars.discourse-cdn.com/v4/letter/h/f14d63/32.png) [@himanshu123](https://devforum.okta.com/u/himanshu123)\
**Post date:** [April 16, 2023, 8:41am UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/11 "2023-04-16T08:41:51Z")

</div>

please tell me in more details how to solve this problem.I am also facing same issue

---

<div class="post-metadata">

**Author:** ![himanshu123](https://avatars.discourse-cdn.com/v4/letter/h/f14d63/32.png) [@himanshu123](https://devforum.okta.com/u/himanshu123)\
**Post date:** [April 16, 2023, 8:42am UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/12 "2023-04-16T08:42:22Z")

</div>

same issue I am facing. I am using react js

---

<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 13, 2024, 12:21am UTC](https://devforum.okta.com/t/okta-sign-in-widget-does-nothing-with-token/22023/13 "2024-02-13T00:21:22Z")

</div>


