OktaSignIn is not a constructor

Hi,

I just started using Okta, i’m following this: https://developer.okta.com/quickstart/#/widget/nodejs/express
I’m getting OktaSignIn is not a constructor in the console.

I’m using the npm package, and I use the svelte with sapper framework.
As sapper is SSR I had to import the package dynamically

const OktaSignIn = await import("@okta/okta-signin-widget");

And all the Okta code is encapsulated in an onMount function that fire once the page is loaded by the client.

The Okta Sign-In Widget doesn’t currently support SSR frameworks. https://github.com/okta/okta-signin-widget/issues/295

One thing you might try is putting the Sign-In Widget in its own standalone HTML page and redirecting to it when your users need to login. Then it’d be outside the scope of your compilation process.

If you’re building a nodeJS application then you can use okta-OIDC framework to do the Server Side Auth. (actually it doesn’t matter if it’s node or .net etc since we have SDKs for most major languages) and use the widget in an HTML as suggested above. I’ve used this method with ejs successfully, but ejs supports writing pure HTML code, but I haven’t used sapper.