JS Sign-In Widget Quickstart hasTokensInUrl undefined


I am testing a new single-page app with an Okta dev account.

I am following the instructions for the JavaScript widget at Okta Sign-In Widget Quickstart.

Per the instructions, I added the CDN links for version 3.2.0 of the Sign-In Widget to my HTML page. Next I added a <div id="okta-login-container"></div> and the example <script> block, replacing the placeholders yourOktaDomain and clientId with the appropriate values.

On load, the JavaScript console logs an error:

(index):21 Uncaught TypeError: Cannot read property 'hasTokensInUrl' of undefined

In the JS console, I can see that the oktaSignIn object does not have a property named session, as the sample code seems to expect.

Thank you.

Hi @stuart.sierra.drest

Can you please provide the full script that you are using in order to see what is the cause of the issue?


I should clarify that I’m not seeking assistance. I only wanted to report that the sample code on this page does not work:

The code I’m referring to is under the heading “Configure the Sign-In Widget” and begins with the following lines:

<script type="text/javascript">
  var oktaSignIn = new OktaSignIn({
    baseUrl: "https://${yourOktaDomain}",
    clientId: "{clientId}",
    authParams: {
      issuer: "https://${yourOktaDomain}/oauth2/default",
      responseType: ['token', 'id_token'],
      display: 'page'
  if (oktaSignIn.token.hasTokensInUrl()) {

When I tried to use this sample code it failed with the error I reported. Perhaps this is due to a change in the public API of OktaSignIn since that example was written.

Hope this helps.

Yes, I’m having the same issue.

It seems hasTokensInUrl works on the root oktaSignIn object but then fails again at the session property.

For anyone looking for the 3.0+ compatible API changes pending the guide update:



oktaSignIn.session.get(function (res) {...
oktaSignIn.authClient.session.get().then(function (res) {...