I believe this bug is at the type level. The issuer prop to the constructor of OktaAuth is marked as string | undefined. However, undefined results in a runtime error as you can see in the following screenshot:
Reproduction Steps?
Import OktaAuth and instantiate it with just passing an empty object
import { OktaAuth } from "@okta/okta-auth-js";
new OktaAuth({});
Observe there are no type errors
Run the code
Observe the runtime error
Uncaught AuthSdkError: No issuer passed to constructor. Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})
at <anonymous>:2:270564
at new g (<anonymous>:2:271060)
at l.f (<anonymous>:2:51190)
at new l (<anonymous>:2:51316)
at l.f (<anonymous>:2:119912)
at new l (<anonymous>:2:120038)
at new t (<anonymous>:2:9188)
at s.l (<anonymous>:2:303846)
at new p (<anonymous>:2:304042)
at s.d (<anonymous>:2:69354)
Describe the bug
I believe this bug is at the type level. The
issuer
prop to the constructor ofOktaAuth
is marked asstring | undefined
. However, undefined results in a runtime error as you can see in the following screenshot:Reproduction Steps?
OktaAuth
and instantiate it with just passing an empty objectSDK Versions
System: OS: macOS 14.1 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 23.51 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm pnpm: 7.29.3 - /usr/local/bin/pnpm bun: 1.0.9 - ~/.bun/bin/bun Browsers: Brave Browser: 119.1.60.114 Chrome: 119.0.6045.123 Safari: 17.1 npmPackages: @okta/okta-auth-js: ^7.4.3 => 7.4.3
Additional Information?
No response