@okta/okta-auth-js 5.10.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +10 -6
  3. package/cjs/AuthStateManager.js +11 -3
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +139 -95
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/OktaUserAgent.js.map +1 -1
  9. package/cjs/PromiseQueue.js +11 -2
  10. package/cjs/PromiseQueue.js.map +1 -1
  11. package/cjs/SavedObject.js +4 -2
  12. package/cjs/SavedObject.js.map +1 -1
  13. package/cjs/StorageManager.js +16 -9
  14. package/cjs/StorageManager.js.map +1 -1
  15. package/cjs/TokenManager.js +38 -22
  16. package/cjs/TokenManager.js.map +1 -1
  17. package/cjs/TransactionManager.js +26 -7
  18. package/cjs/TransactionManager.js.map +1 -1
  19. package/cjs/browser/browserStorage.js +25 -14
  20. package/cjs/browser/browserStorage.js.map +1 -1
  21. package/cjs/browser/fingerprint.js +12 -4
  22. package/cjs/browser/fingerprint.js.map +1 -1
  23. package/cjs/builderUtil.js +7 -19
  24. package/cjs/builderUtil.js.map +1 -1
  25. package/cjs/clock.js +5 -1
  26. package/cjs/clock.js.map +1 -1
  27. package/cjs/crypto/base64.js +18 -0
  28. package/cjs/crypto/base64.js.map +1 -1
  29. package/cjs/crypto/index.js +6 -4
  30. package/cjs/crypto/index.js.map +1 -1
  31. package/cjs/crypto/oidcHash.js +5 -1
  32. package/cjs/crypto/oidcHash.js.map +1 -1
  33. package/cjs/crypto/webauthn.js +101 -0
  34. package/cjs/crypto/webauthn.js.map +1 -0
  35. package/cjs/crypto/webcrypto.js +3 -1
  36. package/cjs/crypto/webcrypto.js.map +1 -1
  37. package/cjs/errors/AuthApiError.js +1 -1
  38. package/cjs/errors/AuthPollStopError.js +1 -1
  39. package/cjs/errors/AuthSdkError.js +1 -1
  40. package/cjs/errors/CustomError.js +5 -1
  41. package/cjs/errors/CustomError.js.map +1 -1
  42. package/cjs/errors/OAuthError.js +1 -1
  43. package/cjs/errors/index.js +1 -1
  44. package/cjs/features.js +9 -3
  45. package/cjs/features.js.map +1 -1
  46. package/cjs/fetch/fetchRequest.js +19 -6
  47. package/cjs/fetch/fetchRequest.js.map +1 -1
  48. package/cjs/http/headers.js.map +1 -1
  49. package/cjs/http/index.js +4 -2
  50. package/cjs/http/index.js.map +1 -1
  51. package/cjs/http/request.js +11 -5
  52. package/cjs/http/request.js.map +1 -1
  53. package/cjs/idx/authenticate.js +8 -5
  54. package/cjs/idx/authenticate.js.map +1 -1
  55. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  56. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  57. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  58. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  59. package/cjs/idx/authenticator/SecurityQuestionVerification.js +2 -1
  60. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  61. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -2
  62. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  63. package/cjs/idx/authenticator/WebauthnEnrollment.js +46 -0
  64. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -0
  65. package/cjs/idx/authenticator/WebauthnVerification.js +55 -0
  66. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -0
  67. package/cjs/idx/authenticator/getAuthenticator.js +17 -6
  68. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  69. package/cjs/idx/authenticator/index.js +34 -6
  70. package/cjs/idx/authenticator/index.js.map +1 -1
  71. package/cjs/idx/cancel.js.map +1 -1
  72. package/cjs/idx/emailVerify.js +73 -0
  73. package/cjs/idx/emailVerify.js.map +1 -0
  74. package/cjs/idx/flow/AccountUnlockFlow.js +30 -0
  75. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -0
  76. package/cjs/idx/flow/AuthenticationFlow.js +2 -1
  77. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
  78. package/cjs/idx/flow/FlowSpecification.js +24 -4
  79. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  80. package/cjs/idx/flow/PasswordRecoveryFlow.js +4 -1
  81. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  82. package/cjs/idx/flow/RegistrationFlow.js +2 -0
  83. package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
  84. package/cjs/idx/flow/index.js +20 -5
  85. package/cjs/idx/flow/index.js.map +1 -1
  86. package/cjs/idx/handleInteractionCodeRedirect.js +6 -1
  87. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  88. package/cjs/idx/headers.js +21 -5
  89. package/cjs/idx/headers.js.map +1 -1
  90. package/cjs/idx/idx-js/client.js +91 -0
  91. package/cjs/idx/idx-js/client.js.map +1 -0
  92. package/cjs/idx/idx-js/index.js +162 -0
  93. package/cjs/idx/idx-js/index.js.map +1 -0
  94. package/cjs/idx/idx-js/interact.js +83 -0
  95. package/cjs/idx/idx-js/interact.js.map +1 -0
  96. package/cjs/idx/idx-js/introspect.js +58 -0
  97. package/cjs/idx/idx-js/introspect.js.map +1 -0
  98. package/cjs/idx/idx-js/parsers.js +41 -0
  99. package/cjs/idx/idx-js/parsers.js.map +1 -0
  100. package/cjs/idx/idx-js/util.js +34 -0
  101. package/cjs/idx/idx-js/util.js.map +1 -0
  102. package/cjs/idx/idx-js/v1/actionParser.js +90 -0
  103. package/cjs/idx/idx-js/v1/actionParser.js.map +1 -0
  104. package/cjs/idx/idx-js/v1/generateIdxAction.js +117 -0
  105. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -0
  106. package/cjs/idx/idx-js/v1/idxResponseParser.js +137 -0
  107. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +1 -0
  108. package/cjs/idx/idx-js/v1/makeIdxState.js +64 -0
  109. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -0
  110. package/cjs/idx/idx-js/v1/parsers.js +24 -0
  111. package/cjs/idx/idx-js/v1/parsers.js.map +1 -0
  112. package/cjs/idx/idx-js/v1/remediationParser.js +32 -0
  113. package/cjs/idx/idx-js/v1/remediationParser.js.map +1 -0
  114. package/cjs/idx/index.js +121 -109
  115. package/cjs/idx/index.js.map +1 -1
  116. package/cjs/idx/interact.js +53 -36
  117. package/cjs/idx/interact.js.map +1 -1
  118. package/cjs/idx/introspect.js +17 -19
  119. package/cjs/idx/introspect.js.map +1 -1
  120. package/cjs/idx/poll.js +13 -3
  121. package/cjs/idx/poll.js.map +1 -1
  122. package/cjs/idx/proceed.js +4 -7
  123. package/cjs/idx/proceed.js.map +1 -1
  124. package/cjs/idx/recoverPassword.js +1 -1
  125. package/cjs/idx/recoverPassword.js.map +1 -1
  126. package/cjs/idx/register.js +11 -16
  127. package/cjs/idx/register.js.map +1 -1
  128. package/cjs/idx/remediate.js +74 -27
  129. package/cjs/idx/remediate.js.map +1 -1
  130. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +12 -4
  131. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  132. package/cjs/idx/remediators/AuthenticatorVerificationData.js +13 -7
  133. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  134. package/cjs/idx/remediators/Base/AuthenticatorData.js +31 -13
  135. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  136. package/cjs/idx/remediators/Base/Remediator.js +67 -31
  137. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  138. package/cjs/idx/remediators/Base/SelectAuthenticator.js +46 -30
  139. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  140. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +16 -4
  141. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  142. package/cjs/idx/remediators/ChallengeAuthenticator.js +2 -2
  143. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  144. package/cjs/idx/remediators/ChallengePoll.js +2 -2
  145. package/cjs/idx/remediators/EnrollAuthenticator.js +2 -2
  146. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  147. package/cjs/idx/remediators/EnrollPoll.js +18 -9
  148. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  149. package/cjs/idx/remediators/EnrollProfile.js +24 -9
  150. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  151. package/cjs/idx/remediators/EnrollmentChannelData.js +96 -0
  152. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -0
  153. package/cjs/idx/remediators/Identify.js +5 -3
  154. package/cjs/idx/remediators/Identify.js.map +1 -1
  155. package/cjs/idx/remediators/ReEnrollAuthenticator.js +6 -3
  156. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  157. package/cjs/idx/remediators/RedirectIdp.js +2 -2
  158. package/cjs/idx/remediators/ResetAuthenticator.js +2 -2
  159. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  160. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +7 -5
  161. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  162. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +2 -2
  163. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  164. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +72 -0
  165. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -0
  166. package/cjs/idx/remediators/SelectEnrollProfile.js +2 -2
  167. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  168. package/cjs/idx/remediators/SelectEnrollmentChannel.js +86 -0
  169. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -0
  170. package/cjs/idx/remediators/Skip.js +5 -3
  171. package/cjs/idx/remediators/Skip.js.map +1 -1
  172. package/cjs/idx/remediators/index.js +57 -16
  173. package/cjs/idx/remediators/index.js.map +1 -1
  174. package/cjs/idx/remediators/util.js +18 -3
  175. package/cjs/idx/remediators/util.js.map +1 -1
  176. package/cjs/idx/run.js +139 -49
  177. package/cjs/idx/run.js.map +1 -1
  178. package/cjs/idx/startTransaction.js +4 -2
  179. package/cjs/idx/startTransaction.js.map +1 -1
  180. package/cjs/idx/transactionMeta.js +82 -69
  181. package/cjs/idx/transactionMeta.js.map +1 -1
  182. package/cjs/idx/types/idx-js.js.map +1 -1
  183. package/cjs/idx/types/index.js +59 -7
  184. package/cjs/idx/types/index.js.map +1 -1
  185. package/cjs/idx/unlockAccount.js +48 -0
  186. package/cjs/idx/unlockAccount.js.map +1 -0
  187. package/cjs/index.js +33 -13
  188. package/cjs/index.js.map +1 -1
  189. package/cjs/oidc/endpoints/authorize.js +10 -2
  190. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  191. package/cjs/oidc/endpoints/index.js +5 -3
  192. package/cjs/oidc/endpoints/index.js.map +1 -1
  193. package/cjs/oidc/endpoints/token.js +16 -3
  194. package/cjs/oidc/endpoints/token.js.map +1 -1
  195. package/cjs/oidc/endpoints/well-known.js +7 -3
  196. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  197. package/cjs/oidc/exchangeCodeForTokens.js +12 -4
  198. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  199. package/cjs/oidc/getToken.js +12 -6
  200. package/cjs/oidc/getToken.js.map +1 -1
  201. package/cjs/oidc/getUserInfo.js +7 -3
  202. package/cjs/oidc/getUserInfo.js.map +1 -1
  203. package/cjs/oidc/getWithPopup.js +8 -2
  204. package/cjs/oidc/getWithPopup.js.map +1 -1
  205. package/cjs/oidc/getWithRedirect.js +15 -38
  206. package/cjs/oidc/getWithRedirect.js.map +1 -1
  207. package/cjs/oidc/getWithoutPrompt.js +8 -2
  208. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  209. package/cjs/oidc/handleOAuthResponse.js +87 -87
  210. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  211. package/cjs/oidc/index.js +4 -2
  212. package/cjs/oidc/index.js.map +1 -1
  213. package/cjs/oidc/parseFromUrl.js +9 -3
  214. package/cjs/oidc/parseFromUrl.js.map +1 -1
  215. package/cjs/oidc/renewToken.js.map +1 -1
  216. package/cjs/oidc/renewTokens.js +6 -2
  217. package/cjs/oidc/renewTokens.js.map +1 -1
  218. package/cjs/oidc/renewTokensWithRefresh.js +5 -1
  219. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  220. package/cjs/oidc/revokeToken.js +34 -31
  221. package/cjs/oidc/revokeToken.js.map +1 -1
  222. package/cjs/oidc/util/browser.js +5 -1
  223. package/cjs/oidc/util/browser.js.map +1 -1
  224. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  225. package/cjs/oidc/util/errors.js.map +1 -1
  226. package/cjs/oidc/util/index.js +27 -11
  227. package/cjs/oidc/util/index.js.map +1 -1
  228. package/cjs/oidc/util/loginRedirect.js +10 -1
  229. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  230. package/cjs/oidc/util/oauth.js +4 -2
  231. package/cjs/oidc/util/oauth.js.map +1 -1
  232. package/cjs/oidc/util/oauthMeta.js +36 -0
  233. package/cjs/oidc/util/oauthMeta.js.map +1 -0
  234. package/cjs/oidc/util/pkce.js +11 -3
  235. package/cjs/oidc/util/pkce.js.map +1 -1
  236. package/cjs/oidc/util/prepareTokenParams.js +62 -39
  237. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  238. package/cjs/oidc/util/validateClaims.js +3 -1
  239. package/cjs/oidc/util/validateClaims.js.map +1 -1
  240. package/cjs/oidc/verifyToken.js +13 -4
  241. package/cjs/oidc/verifyToken.js.map +1 -1
  242. package/cjs/options.js +12 -6
  243. package/cjs/options.js.map +1 -1
  244. package/cjs/server/serverStorage.js +2 -1
  245. package/cjs/server/serverStorage.js.map +1 -1
  246. package/cjs/services/TokenService.js +3 -0
  247. package/cjs/services/TokenService.js.map +1 -1
  248. package/cjs/tx/AuthTransaction.js +18 -9
  249. package/cjs/tx/AuthTransaction.js.map +1 -1
  250. package/cjs/tx/TransactionState.js +0 -17
  251. package/cjs/tx/TransactionState.js.map +1 -1
  252. package/cjs/tx/api.js +11 -6
  253. package/cjs/tx/api.js.map +1 -1
  254. package/cjs/tx/index.js +7 -5
  255. package/cjs/tx/index.js.map +1 -1
  256. package/cjs/tx/poll.js +6 -4
  257. package/cjs/tx/poll.js.map +1 -1
  258. package/cjs/tx/util.js +5 -1
  259. package/cjs/tx/util.js.map +1 -1
  260. package/cjs/types/Transaction.js +10 -2
  261. package/cjs/types/Transaction.js.map +1 -1
  262. package/cjs/types/index.js +16 -14
  263. package/cjs/types/index.js.map +1 -1
  264. package/cjs/util/index.js +7 -18
  265. package/cjs/util/index.js.map +1 -1
  266. package/cjs/util/misc.js +5 -1
  267. package/cjs/util/misc.js.map +1 -1
  268. package/cjs/util/object.js +16 -6
  269. package/cjs/util/object.js.map +1 -1
  270. package/cjs/util/sharedStorage.js +5 -1
  271. package/cjs/util/sharedStorage.js.map +1 -1
  272. package/cjs/util/url.js.map +1 -1
  273. package/dist/okta-auth-js.min.js +1 -1
  274. package/dist/okta-auth-js.min.js.LICENSE.txt +0 -12
  275. package/dist/okta-auth-js.min.js.map +1 -1
  276. package/dist/okta-auth-js.polyfill.js +1 -1
  277. package/dist/okta-auth-js.polyfill.js.map +1 -1
  278. package/dist/okta-auth-js.umd.js +1 -1
  279. package/dist/okta-auth-js.umd.js.LICENSE.txt +0 -12
  280. package/dist/okta-auth-js.umd.js.map +1 -1
  281. package/esm/index.js +2758 -957
  282. package/esm/index.js.map +1 -1
  283. package/lib/AuthStateManager.d.ts +1 -2
  284. package/lib/OktaAuth.d.ts +10 -13
  285. package/lib/StorageManager.d.ts +2 -2
  286. package/lib/TokenManager.d.ts +4 -4
  287. package/lib/TransactionManager.d.ts +4 -3
  288. package/lib/browser/fingerprint.d.ts +2 -3
  289. package/lib/builderUtil.d.ts +1 -2
  290. package/lib/crypto/base64.d.ts +2 -0
  291. package/lib/crypto/browser.d.ts +1 -1
  292. package/lib/crypto/webauthn.d.ts +25 -0
  293. package/lib/features.d.ts +1 -1
  294. package/lib/http/headers.d.ts +2 -2
  295. package/lib/http/request.d.ts +4 -4
  296. package/lib/idx/authenticate.d.ts +2 -2
  297. package/lib/idx/authenticator/Authenticator.d.ts +4 -5
  298. package/lib/idx/authenticator/OktaPassword.d.ts +7 -9
  299. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +9 -8
  300. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +7 -7
  301. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +6 -2
  302. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +16 -0
  303. package/lib/idx/authenticator/WebauthnVerification.d.ts +17 -0
  304. package/lib/idx/authenticator/getAuthenticator.d.ts +1 -1
  305. package/lib/idx/authenticator/index.d.ts +9 -0
  306. package/lib/idx/cancel.d.ts +2 -2
  307. package/lib/idx/emailVerify.d.ts +26 -0
  308. package/lib/{util/emailVerify.d.ts → idx/flow/AccountUnlockFlow.d.ts} +2 -6
  309. package/lib/idx/flow/FlowSpecification.d.ts +3 -2
  310. package/lib/idx/flow/index.d.ts +1 -0
  311. package/lib/idx/headers.d.ts +3 -2
  312. package/lib/idx/idx-js/client.d.ts +36 -0
  313. package/lib/idx/idx-js/index.d.ts +51 -0
  314. package/lib/idx/idx-js/interact.d.ts +25 -0
  315. package/lib/idx/idx-js/introspect.d.ts +20 -0
  316. package/lib/idx/idx-js/parsers.d.ts +15 -0
  317. package/lib/idx/idx-js/util.d.ts +12 -0
  318. package/lib/idx/idx-js/v1/actionParser.d.ts +16 -0
  319. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +13 -0
  320. package/lib/idx/idx-js/v1/idxResponseParser.d.ts +20 -0
  321. package/lib/idx/idx-js/v1/makeIdxState.d.ts +13 -0
  322. package/lib/idx/idx-js/v1/parsers.d.ts +16 -0
  323. package/lib/idx/idx-js/v1/remediationParser.d.ts +12 -0
  324. package/lib/idx/index.d.ts +12 -10
  325. package/lib/idx/interact.d.ts +7 -13
  326. package/lib/idx/introspect.d.ts +4 -3
  327. package/lib/idx/poll.d.ts +2 -2
  328. package/lib/idx/proceed.d.ts +8 -5
  329. package/lib/idx/recoverPassword.d.ts +2 -2
  330. package/lib/idx/register.d.ts +2 -2
  331. package/lib/idx/remediate.d.ts +10 -4
  332. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +3 -3
  333. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +3 -3
  334. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +8 -7
  335. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +10 -7
  336. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +8 -12
  337. package/lib/idx/remediators/EnrollPoll.d.ts +1 -1
  338. package/lib/idx/remediators/EnrollProfile.d.ts +1 -1
  339. package/lib/idx/remediators/EnrollmentChannelData.d.ts +54 -0
  340. package/lib/idx/remediators/Identify.d.ts +2 -2
  341. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -2
  342. package/lib/idx/remediators/RedirectIdp.d.ts +3 -3
  343. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +38 -0
  344. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +40 -0
  345. package/lib/idx/remediators/index.d.ts +3 -0
  346. package/lib/idx/remediators/util.d.ts +2 -2
  347. package/lib/idx/run.d.ts +5 -3
  348. package/lib/idx/startTransaction.d.ts +3 -2
  349. package/lib/idx/transactionMeta.d.ts +10 -31
  350. package/lib/idx/types/FlowIdentifier.d.ts +1 -1
  351. package/lib/idx/types/idx-js.d.ts +44 -1
  352. package/lib/idx/types/index.d.ts +36 -9
  353. package/lib/idx/unlockAccount.d.ts +15 -0
  354. package/lib/index.d.ts +1 -0
  355. package/lib/oidc/endpoints/well-known.d.ts +3 -3
  356. package/lib/oidc/exchangeCodeForTokens.d.ts +14 -2
  357. package/lib/oidc/getToken.d.ts +2 -2
  358. package/lib/oidc/getWithPopup.d.ts +2 -2
  359. package/lib/oidc/getWithRedirect.d.ts +2 -2
  360. package/lib/oidc/getWithoutPrompt.d.ts +2 -2
  361. package/lib/oidc/handleOAuthResponse.d.ts +2 -2
  362. package/lib/oidc/parseFromUrl.d.ts +1 -1
  363. package/lib/oidc/renewToken.d.ts +2 -2
  364. package/lib/oidc/renewTokens.d.ts +1 -1
  365. package/lib/oidc/renewTokensWithRefresh.d.ts +2 -2
  366. package/lib/oidc/revokeToken.d.ts +2 -2
  367. package/lib/oidc/util/browser.d.ts +3 -3
  368. package/lib/oidc/util/defaultTokenParams.d.ts +2 -2
  369. package/lib/oidc/util/errors.d.ts +2 -2
  370. package/lib/oidc/util/index.d.ts +1 -0
  371. package/lib/oidc/util/loginRedirect.d.ts +4 -4
  372. package/lib/oidc/util/oauth.d.ts +4 -11
  373. package/lib/oidc/util/oauthMeta.d.ts +2 -0
  374. package/lib/oidc/util/prepareTokenParams.d.ts +5 -2
  375. package/lib/oidc/util/validateClaims.d.ts +2 -2
  376. package/lib/oidc/verifyToken.d.ts +2 -2
  377. package/lib/server/serverStorage.d.ts +1 -1
  378. package/lib/services/TokenService.d.ts +2 -2
  379. package/lib/tx/AuthTransaction.d.ts +2 -2
  380. package/lib/tx/TransactionState.d.ts +11 -1
  381. package/lib/tx/api.d.ts +6 -6
  382. package/lib/types/OktaAuthOptions.d.ts +6 -8
  383. package/lib/types/Storage.d.ts +3 -3
  384. package/lib/types/Transaction.d.ts +10 -7
  385. package/lib/types/UserClaims.d.ts +3 -3
  386. package/lib/types/api.d.ts +44 -20
  387. package/lib/types/index.d.ts +0 -1
  388. package/lib/util/console.d.ts +1 -1
  389. package/lib/util/index.d.ts +0 -1
  390. package/lib/util/sharedStorage.d.ts +1 -1
  391. package/lib/util/types.d.ts +1 -1
  392. package/lib/util/url.d.ts +2 -2
  393. package/package.json +10 -7
  394. package/polyfill/index.js +1 -0
  395. package/cjs/util/emailVerify.js +0 -28
  396. package/cjs/util/emailVerify.js.map +0 -1
package/cjs/OktaAuth.js CHANGED
@@ -1,9 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
4
+
5
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
6
+
7
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
8
 
5
9
  exports.default = void 0;
6
10
 
11
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
12
+
13
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
14
+
15
+ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
16
+
17
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
18
+
7
19
  var constants = _interopRequireWildcard(require("./constants"));
8
20
 
9
21
  var _tx = require("./tx");
@@ -16,12 +28,14 @@ var _oidc = require("./oidc");
16
28
 
17
29
  var features = _interopRequireWildcard(require("./features"));
18
30
 
31
+ var crypto = _interopRequireWildcard(require("./crypto"));
32
+
33
+ var webauthn = _interopRequireWildcard(require("./crypto/webauthn"));
34
+
19
35
  var _browserStorage = _interopRequireDefault(require("./browser/browserStorage"));
20
36
 
21
37
  var _util = require("./util");
22
38
 
23
- var _builderUtil = require("./builderUtil");
24
-
25
39
  var _TokenManager = require("./TokenManager");
26
40
 
27
41
  var _http = require("./http");
@@ -32,7 +46,7 @@ var _fingerprint = _interopRequireDefault(require("./browser/fingerprint"));
32
46
 
33
47
  var _AuthStateManager = require("./AuthStateManager");
34
48
 
35
- var _StorageManager = _interopRequireDefault(require("./StorageManager"));
49
+ var _StorageManager = require("./StorageManager");
36
50
 
37
51
  var _TransactionManager = _interopRequireDefault(require("./TransactionManager"));
38
52
 
@@ -46,9 +60,11 @@ var _OktaUserAgent = require("./OktaUserAgent");
46
60
 
47
61
  var _parseFromUrl = require("./oidc/parseFromUrl");
48
62
 
49
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
63
+ var _transactionMeta = require("./idx/transactionMeta");
64
+
65
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
50
66
 
51
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
67
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
52
68
 
53
69
  /* eslint-disable max-statements */
54
70
 
@@ -66,32 +82,30 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
66
82
  * See the License for the specific language governing permissions and limitations under the License.
67
83
  */
68
84
 
69
- /* SDK_VERSION is defined in webpack config */
70
-
71
- /* global window, SDK_VERSION */
85
+ /* global window */
86
+ // eslint-disable-next-line import/no-commonjs
72
87
  const Emitter = require('tiny-emitter');
73
88
 
74
89
  class OktaAuth {
75
- // keep this field to compatible with released downstream SDK versions
76
- // TODO: remove in version 6
77
- // JIRA: https://oktainc.atlassian.net/browse/OKTA-419417
78
90
  constructor(args) {
79
- const options = this.options = (0, _options.buildOptions)(args);
80
- this.storageManager = new _StorageManager.default(options.storageManager, options.cookies, options.storageUtil);
81
- this.transactionManager = new _TransactionManager.default(Object.assign({
91
+ const options = this.options = (0, _options.buildOptions)(args); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
92
+
93
+ this.storageManager = new _StorageManager.StorageManager(options.storageManager, options.cookies, options.storageUtil);
94
+ this.transactionManager = new _TransactionManager.default((0, _assign.default)({
82
95
  storageManager: this.storageManager
83
96
  }, options.transactionManager));
84
97
  this._oktaUserAgent = new _OktaUserAgent.OktaUserAgent();
85
98
  this.tx = {
86
99
  status: _tx.transactionStatus.bind(null, this),
87
100
  resume: _tx.resumeTransaction.bind(null, this),
88
- exists: Object.assign(_tx.transactionExists.bind(null, this), {
101
+ exists: (0, _assign.default)(_tx.transactionExists.bind(null, this), {
89
102
  _get: name => {
103
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
90
104
  const storage = options.storageUtil.storage;
91
105
  return storage.get(name);
92
106
  }
93
107
  }),
94
- introspect: _tx.introspect.bind(null, this)
108
+ introspect: _tx.introspectAuthn.bind(null, this)
95
109
  };
96
110
  this.pkce = {
97
111
  DEFAULT_CODE_CHALLENGE_METHOD: _pkce.default.DEFAULT_CODE_CHALLENGE_METHOD,
@@ -99,7 +113,7 @@ class OktaAuth {
99
113
  computeChallenge: _pkce.default.computeChallenge
100
114
  }; // Add shims for compatibility, these will be removed in next major version. OKTA-362589
101
115
 
102
- Object.assign(this.options.storageUtil, {
116
+ (0, _assign.default)(this.options.storageUtil, {
103
117
  getPKCEStorage: this.storageManager.getLegacyPKCEStorage.bind(this.storageManager),
104
118
  getHttpCache: this.storageManager.getHttpCache.bind(this.storageManager)
105
119
  });
@@ -108,13 +122,10 @@ class OktaAuth {
108
122
  };
109
123
 
110
124
  if ((0, features.isBrowser)()) {
111
- this.options = Object.assign(this.options, {
125
+ this.options = (0, _assign.default)(this.options, {
112
126
  redirectUri: (0, _util.toAbsoluteUrl)(args.redirectUri, window.location.origin) // allow relative URIs
113
127
 
114
128
  });
115
- this.userAgent = (0, _builderUtil.getUserAgent)(args, `okta-auth-js/${"5.10.0"}`);
116
- } else {
117
- this.userAgent = (0, _builderUtil.getUserAgent)(args, `okta-auth-js-server/${"5.10.0"}`);
118
129
  } // Digital clocks will drift over time, so the server
119
130
  // can misalign with the time reported by the browser.
120
131
  // The maxClockSkew allows relaxing the time-based
@@ -142,13 +153,42 @@ class OktaAuth {
142
153
  setCookieAndRedirect: _session.setCookieAndRedirect.bind(null, this)
143
154
  };
144
155
  this._tokenQueue = new _PromiseQueue.default();
156
+
157
+ const useQueue = method => {
158
+ return _PromiseQueue.default.prototype.push.bind(this._tokenQueue, method, null);
159
+ }; // eslint-disable-next-line max-len
160
+
161
+
162
+ const getWithRedirectFn = useQueue(_oidc.getWithRedirect.bind(null, this));
163
+ const getWithRedirectApi = (0, _assign.default)(getWithRedirectFn, {
164
+ // This is exposed so we can set window.location in our tests
165
+ _setLocation: function (url) {
166
+ window.location = url;
167
+ }
168
+ }); // eslint-disable-next-line max-len
169
+
170
+ const parseFromUrlFn = useQueue(_oidc.parseFromUrl.bind(null, this));
171
+ const parseFromUrlApi = (0, _assign.default)(parseFromUrlFn, {
172
+ // This is exposed so we can mock getting window.history in our tests
173
+ _getHistory: function () {
174
+ return window.history;
175
+ },
176
+ // This is exposed so we can mock getting window.location in our tests
177
+ _getLocation: function () {
178
+ return window.location;
179
+ },
180
+ // This is exposed so we can mock getting window.document in our tests
181
+ _getDocument: function () {
182
+ return window.document;
183
+ }
184
+ });
145
185
  this.token = {
146
186
  prepareTokenParams: _oidc.prepareTokenParams.bind(null, this),
147
187
  exchangeCodeForTokens: _oidc.exchangeCodeForTokens.bind(null, this),
148
188
  getWithoutPrompt: _oidc.getWithoutPrompt.bind(null, this),
149
189
  getWithPopup: _oidc.getWithPopup.bind(null, this),
150
- getWithRedirect: _oidc.getWithRedirect.bind(null, this),
151
- parseFromUrl: _oidc.parseFromUrl.bind(null, this),
190
+ getWithRedirect: getWithRedirectApi,
191
+ parseFromUrl: parseFromUrlApi,
152
192
  decode: _oidc.decodeToken,
153
193
  revoke: _oidc.revokeToken.bind(null, this),
154
194
  renew: _oidc.renewToken.bind(null, this),
@@ -159,55 +199,57 @@ class OktaAuth {
159
199
  isLoginRedirect: _oidc.isLoginRedirect.bind(null, this)
160
200
  }; // Wrap all async token API methods using MethodQueue to avoid issues with concurrency
161
201
 
162
- const syncMethods = ['decode', 'isLoginRedirect'];
163
- Object.keys(this.token).forEach(key => {
164
- if (syncMethods.indexOf(key) >= 0) {
202
+ const syncMethods = [// sync methods
203
+ 'decode', 'isLoginRedirect', // already bound
204
+ 'getWithRedirect', 'parseFromUrl'];
205
+ (0, _keys.default)(this.token).forEach(key => {
206
+ if ((0, _indexOf.default)(syncMethods).call(syncMethods, key) >= 0) {
165
207
  // sync methods should not be wrapped
166
208
  return;
167
209
  }
168
210
 
169
211
  var method = this.token[key];
170
212
  this.token[key] = _PromiseQueue.default.prototype.push.bind(this._tokenQueue, method, null);
171
- });
172
- Object.assign(this.token.getWithRedirect, {
173
- // This is exposed so we can set window.location in our tests
174
- _setLocation: function (url) {
175
- window.location = url;
176
- }
177
- });
178
- Object.assign(this.token.parseFromUrl, {
179
- // This is exposed so we can mock getting window.history in our tests
180
- _getHistory: function () {
181
- return window.history;
182
- },
183
- // This is exposed so we can mock getting window.location in our tests
184
- _getLocation: function () {
185
- return window.location;
186
- },
187
- // This is exposed so we can mock getting window.document in our tests
188
- _getDocument: function () {
189
- return window.document;
190
- }
191
213
  }); // IDX
192
214
 
215
+ const boundStartTransaction = _idx.startTransaction.bind(null, this);
216
+
193
217
  this.idx = {
194
218
  interact: _idx.interact.bind(null, this),
195
219
  introspect: _idx.introspect.bind(null, this),
196
220
  authenticate: _idx.authenticate.bind(null, this),
197
221
  register: _idx.register.bind(null, this),
222
+ start: boundStartTransaction,
223
+ startTransaction: boundStartTransaction,
224
+ // Use `start` instead. `startTransaction` will be removed in 7.0
198
225
  poll: _idx.poll.bind(null, this),
199
226
  proceed: _idx.proceed.bind(null, this),
200
227
  cancel: _idx.cancel.bind(null, this),
201
228
  recoverPassword: _idx.recoverPassword.bind(null, this),
229
+ // oauth redirect callback
202
230
  handleInteractionCodeRedirect: _idx.handleInteractionCodeRedirect.bind(null, this),
203
- startTransaction: _idx.startTransaction.bind(null, this),
231
+ // interaction required callback
232
+ isInteractionRequired: _oidc.isInteractionRequired.bind(null, this),
233
+ isInteractionRequiredError: _oidc.isInteractionRequiredError,
234
+ // email verify callback
235
+ handleEmailVerifyCallback: _idx.handleEmailVerifyCallback.bind(null, this),
236
+ isEmailVerifyCallback: _idx.isEmailVerifyCallback,
237
+ parseEmailVerifyCallback: _idx.parseEmailVerifyCallback,
238
+ isEmailVerifyCallbackError: _idx.isEmailVerifyCallbackError,
239
+ getSavedTransactionMeta: _transactionMeta.getSavedTransactionMeta.bind(null, this),
240
+ createTransactionMeta: _transactionMeta.createTransactionMeta.bind(null, this),
241
+ getTransactionMeta: _transactionMeta.getTransactionMeta.bind(null, this),
242
+ saveTransactionMeta: _transactionMeta.saveTransactionMeta.bind(null, this),
243
+ clearTransactionMeta: _transactionMeta.clearTransactionMeta.bind(null, this),
244
+ isTransactionMetaValid: _transactionMeta.isTransactionMetaValid,
204
245
  setFlow: flow => {
205
246
  this.options.flow = flow;
206
247
  },
207
248
  getFlow: () => {
208
249
  return this.options.flow;
209
250
  },
210
- canProceed: _idx.canProceed.bind(null, this)
251
+ canProceed: _idx.canProceed.bind(null, this),
252
+ unlockAccount: _idx.unlockAccount.bind(null, this)
211
253
  };
212
254
  (0, _headers.setGlobalRequestInterceptor)((0, _headers.createGlobalRequestInterceptor)(this)); // to pass custom headers to IDX endpoints
213
255
  // HTTP
@@ -237,34 +279,14 @@ class OktaAuth {
237
279
  }
238
280
 
239
281
  setHeaders(headers) {
240
- this.options.headers = Object.assign({}, this.options.headers, headers);
241
- } // ES6 module users can use named exports to access all symbols
242
- // CommonJS module users (CDN) need all exports on this object
243
- // Utility methods for interaction code flow
244
-
245
-
246
- isInteractionRequired(hashOrSearch) {
247
- return (0, _oidc.isInteractionRequired)(this, hashOrSearch);
248
- }
249
-
250
- isInteractionRequiredError(error) {
251
- return (0, _oidc.isInteractionRequiredError)(error);
252
- } // Utility methods for email verify callback
282
+ this.options.headers = (0, _assign.default)({}, this.options.headers, headers);
283
+ } // Authn V1
253
284
 
254
285
 
255
- isEmailVerifyCallback(urlPath) {
256
- return (0, _util.isEmailVerifyCallback)(urlPath);
257
- }
258
-
259
- parseEmailVerifyCallback(urlPath) {
260
- return (0, _util.parseEmailVerifyCallback)(urlPath);
261
- }
262
-
263
286
  async signIn(opts) {
264
- // TODO: support interaction code flow
265
- // Authn V1 flow
266
287
  return this.signInWithCredentials(opts);
267
- }
288
+ } // Authn V1
289
+
268
290
 
269
291
  async signInWithCredentials(opts) {
270
292
  opts = (0, _util.clone)(opts || {});
@@ -306,7 +328,7 @@ class OktaAuth {
306
328
  this.setOriginalUri(originalUri);
307
329
  }
308
330
 
309
- const params = Object.assign({
331
+ const params = (0, _assign.default)({
310
332
  // TODO: remove this line when default scopes are changed OKTA-343294
311
333
  scopes: this.options.scopes || ['openid', 'email', 'profile']
312
334
  }, additionalParams);
@@ -342,7 +364,7 @@ class OktaAuth {
342
364
 
343
365
 
344
366
  if (!accessToken) {
345
- return Promise.resolve(null);
367
+ return _promise.default.resolve(null);
346
368
  }
347
369
 
348
370
  return this.token.revoke(accessToken);
@@ -358,7 +380,7 @@ class OktaAuth {
358
380
 
359
381
 
360
382
  if (!refreshToken) {
361
- return Promise.resolve(null);
383
+ return _promise.default.resolve(null);
362
384
  }
363
385
 
364
386
  return this.token.revoke(refreshToken);
@@ -402,7 +424,7 @@ class OktaAuth {
402
424
 
403
425
 
404
426
  async signOut(options) {
405
- options = Object.assign({}, options); // postLogoutRedirectUri must be whitelisted in Okta Admin UI
427
+ options = (0, _assign.default)({}, options); // postLogoutRedirectUri must be whitelisted in Okta Admin UI
406
428
 
407
429
  var defaultUri = window.location.origin;
408
430
  var currentUri = window.location.href;
@@ -448,11 +470,11 @@ class OktaAuth {
448
470
  }
449
471
  });
450
472
  } else {
451
- if (options.clearTokensAfterRedirect) {
452
- this.tokenManager.addPendingRemoveFlags();
453
- } else {
473
+ if (options.clearTokensBeforeRedirect) {
454
474
  // Clear all local tokens
455
475
  this.tokenManager.clear();
476
+ } else {
477
+ this.tokenManager.addPendingRemoveFlags();
456
478
  } // Flow ends with logout redirect
457
479
 
458
480
 
@@ -486,7 +508,7 @@ class OktaAuth {
486
508
  } = this.tokenManager.getOptions();
487
509
 
488
510
  if (accessToken && this.tokenManager.hasExpired(accessToken)) {
489
- accessToken = null;
511
+ accessToken = undefined;
490
512
 
491
513
  if (autoRenew) {
492
514
  try {
@@ -499,7 +521,7 @@ class OktaAuth {
499
521
  }
500
522
 
501
523
  if (idToken && this.tokenManager.hasExpired(idToken)) {
502
- idToken = null;
524
+ idToken = undefined;
503
525
 
504
526
  if (autoRenew) {
505
527
  try {
@@ -584,7 +606,7 @@ class OktaAuth {
584
606
 
585
607
  const storage = _browserStorage.default.getSessionStorage();
586
608
 
587
- return storage ? storage.getItem(constants.REFERRER_PATH_STORAGE_KEY) : undefined;
609
+ return storage ? storage.getItem(constants.REFERRER_PATH_STORAGE_KEY) || undefined : undefined;
588
610
  }
589
611
 
590
612
  removeOriginalUri(state) {
@@ -597,7 +619,7 @@ class OktaAuth {
597
619
 
598
620
  if (state) {
599
621
  const sharedStorage = this.storageManager.getOriginalUriStorage();
600
- sharedStorage.removeItem(state);
622
+ sharedStorage.removeItem && sharedStorage.removeItem(state);
601
623
  }
602
624
  }
603
625
 
@@ -612,11 +634,17 @@ class OktaAuth {
612
634
  this.tokenManager.setTokens(tokens);
613
635
  originalUri = originalUri || this.getOriginalUri(this.options.state);
614
636
  } else if (this.isLoginRedirect()) {
615
- // For redirect flow, get state from the URL and use it to retrieve the originalUri
616
- const oAuthResponse = await (0, _parseFromUrl.parseOAuthResponseFromUrl)(this, {});
617
- state = oAuthResponse.state;
618
- originalUri = originalUri || this.getOriginalUri(state);
619
- await this.storeTokensFromRedirect();
637
+ try {
638
+ // For redirect flow, get state from the URL and use it to retrieve the originalUri
639
+ const oAuthResponse = await (0, _parseFromUrl.parseOAuthResponseFromUrl)(this, {});
640
+ state = oAuthResponse.state;
641
+ originalUri = originalUri || this.getOriginalUri(state);
642
+ await this.storeTokensFromRedirect();
643
+ } catch (e) {
644
+ // auth state should be updated
645
+ await this.authStateManager.updateAuthState();
646
+ throw e;
647
+ }
620
648
  } else {
621
649
  return; // nothing to do
622
650
  } // ensure auth state has been updated
@@ -632,7 +660,7 @@ class OktaAuth {
632
660
 
633
661
  if (restoreOriginalUri) {
634
662
  await restoreOriginalUri(this, originalUri);
635
- } else {
663
+ } else if (originalUri) {
636
664
  window.location.replace(originalUri);
637
665
  }
638
666
  }
@@ -645,7 +673,9 @@ class OktaAuth {
645
673
  let hasResponseType = false;
646
674
 
647
675
  if (Array.isArray(this.options.responseType) && this.options.responseType.length) {
648
- hasResponseType = this.options.responseType.indexOf(responseType) >= 0;
676
+ var _context;
677
+
678
+ hasResponseType = (0, _indexOf.default)(_context = this.options.responseType).call(_context, responseType) >= 0;
649
679
  } else {
650
680
  hasResponseType = this.options.responseType === responseType;
651
681
  }
@@ -663,6 +693,7 @@ class OktaAuth {
663
693
 
664
694
  getIssuerOrigin() {
665
695
  // Infer the URL from the issuer URL, omitting the /oauth2/{authServerId}
696
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
666
697
  return this.options.issuer.split('/oauth2/')[0];
667
698
  } // { username, (relayState) }
668
699
 
@@ -679,16 +710,29 @@ class OktaAuth {
679
710
 
680
711
  verifyRecoveryToken(opts) {
681
712
  return (0, _tx.postToTransaction)(this, '/api/v1/authn/recovery/token', opts);
713
+ } // Escape hatch method to make arbitrary OKTA API call
714
+
715
+
716
+ async invokeApiMethod(options) {
717
+ if (!options.accessToken) {
718
+ const accessToken = (await this.tokenManager.getTokens()).accessToken;
719
+ options.accessToken = accessToken === null || accessToken === void 0 ? void 0 : accessToken.accessToken;
720
+ }
721
+
722
+ return (0, _http.httpRequest)(this, options);
682
723
  }
683
724
 
684
725
  } // Hoist feature detection functions to static type
685
726
 
686
727
 
687
- OktaAuth.features = OktaAuth.prototype.features = features; // Also hoist values and utility functions for CommonJS users
728
+ OktaAuth.features = OktaAuth.prototype.features = features; // Hoist crypto utils to static type
729
+
730
+ OktaAuth.crypto = crypto; // Hoist webauthn utils to static type
731
+
732
+ OktaAuth.webauthn = webauthn; // Also hoist constants for CommonJS users
688
733
 
689
- Object.assign(OktaAuth, {
690
- constants,
691
- isInteractionRequiredError: _oidc.isInteractionRequiredError
734
+ (0, _assign.default)(OktaAuth, {
735
+ constants
692
736
  });
693
737
  var _default = OktaAuth;
694
738
  exports.default = _default;