@okta/okta-auth-js 5.6.0 → 5.9.1

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 (405) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +28 -1
  3. package/cjs/OktaAuth.js +69 -35
  4. package/cjs/OktaAuth.js.map +1 -1
  5. package/cjs/OktaUserAgent.js +2 -2
  6. package/cjs/StorageManager.js +8 -0
  7. package/cjs/StorageManager.js.map +1 -1
  8. package/cjs/TransactionManager.js +24 -12
  9. package/cjs/TransactionManager.js.map +1 -1
  10. package/cjs/builderUtil.js +6 -0
  11. package/cjs/builderUtil.js.map +1 -1
  12. package/cjs/constants.js +3 -1
  13. package/cjs/constants.js.map +1 -1
  14. package/cjs/features.js +1 -1
  15. package/cjs/features.js.map +1 -1
  16. package/cjs/idx/authenticate.js +3 -18
  17. package/cjs/idx/authenticate.js.map +1 -1
  18. package/cjs/idx/flow/AuthenticationFlow.js +30 -0
  19. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
  20. package/cjs/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.js +0 -0
  21. package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +1 -0
  22. package/cjs/idx/{flowMonitors → flow}/FlowMonitor.js +0 -0
  23. package/cjs/idx/flow/FlowMonitor.js.map +1 -0
  24. package/cjs/idx/flow/FlowSpecification.js +49 -0
  25. package/cjs/idx/flow/FlowSpecification.js.map +1 -0
  26. package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
  27. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
  28. package/cjs/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.js +0 -0
  29. package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +1 -0
  30. package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +15 -12
  31. package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
  32. package/cjs/idx/{flowMonitors → flow}/RegistrationFlowMonitor.js +0 -0
  33. package/cjs/idx/flow/RegistrationFlowMonitor.js.map +1 -0
  34. package/cjs/idx/flow/RemediationFlow.js +2 -0
  35. package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
  36. package/cjs/idx/flow/index.js +119 -0
  37. package/cjs/idx/flow/index.js.map +1 -0
  38. package/cjs/idx/index.js +26 -0
  39. package/cjs/idx/index.js.map +1 -1
  40. package/cjs/idx/interact.js +5 -2
  41. package/cjs/idx/interact.js.map +1 -1
  42. package/cjs/idx/introspect.js +24 -7
  43. package/cjs/idx/introspect.js.map +1 -1
  44. package/cjs/idx/proceed.js +49 -0
  45. package/cjs/idx/proceed.js.map +1 -0
  46. package/cjs/idx/recoverPassword.js +3 -17
  47. package/cjs/idx/recoverPassword.js.map +1 -1
  48. package/cjs/idx/register.js +7 -16
  49. package/cjs/idx/register.js.map +1 -1
  50. package/cjs/idx/remediate.js +33 -37
  51. package/cjs/idx/remediate.js.map +1 -1
  52. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  53. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +3 -1
  54. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  55. package/cjs/idx/remediators/Identify.js +4 -2
  56. package/cjs/idx/remediators/Identify.js.map +1 -1
  57. package/cjs/idx/run.js +36 -8
  58. package/cjs/idx/run.js.map +1 -1
  59. package/cjs/idx/startTransaction.js +2 -0
  60. package/cjs/idx/startTransaction.js.map +1 -1
  61. package/cjs/idx/transactionMeta.js +77 -39
  62. package/cjs/idx/transactionMeta.js.map +1 -1
  63. package/cjs/idx/types/FlowIdentifier.js +2 -0
  64. package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
  65. package/cjs/idx/types/idx-js.js +5 -0
  66. package/cjs/idx/types/idx-js.js.map +1 -1
  67. package/cjs/idx/types/index.js +16 -0
  68. package/cjs/idx/types/index.js.map +1 -1
  69. package/cjs/oidc/endpoints/authorize.js +4 -1
  70. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  71. package/cjs/oidc/getToken.js +14 -9
  72. package/cjs/oidc/getToken.js.map +1 -1
  73. package/cjs/oidc/getWithPopup.js +9 -2
  74. package/cjs/oidc/getWithPopup.js.map +1 -1
  75. package/cjs/oidc/getWithRedirect.js +2 -6
  76. package/cjs/oidc/getWithRedirect.js.map +1 -1
  77. package/cjs/oidc/renewTokens.js +28 -5
  78. package/cjs/oidc/renewTokens.js.map +1 -1
  79. package/cjs/oidc/util/browser.js +1 -13
  80. package/cjs/oidc/util/browser.js.map +1 -1
  81. package/cjs/oidc/util/loginRedirect.js +9 -5
  82. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  83. package/cjs/oidc/util/urlParams.js +1 -1
  84. package/cjs/oidc/util/urlParams.js.map +1 -1
  85. package/cjs/options.js +12 -2
  86. package/cjs/options.js.map +1 -1
  87. package/cjs/server/serverStorage.js +2 -1
  88. package/cjs/server/serverStorage.js.map +1 -1
  89. package/cjs/tx/AuthTransaction.js +1 -3
  90. package/cjs/tx/AuthTransaction.js.map +1 -1
  91. package/cjs/tx/api.js +3 -0
  92. package/cjs/tx/api.js.map +1 -1
  93. package/cjs/types/Transaction.js.map +1 -1
  94. package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
  95. package/cjs/util/emailVerify.js.map +1 -0
  96. package/cjs/util/index.js +13 -0
  97. package/cjs/util/index.js.map +1 -1
  98. package/dist/okta-auth-js.min.js +2 -74
  99. package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
  100. package/dist/okta-auth-js.min.js.map +1 -1
  101. package/dist/okta-auth-js.polyfill.js +2 -18
  102. package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
  103. package/dist/okta-auth-js.polyfill.js.map +1 -1
  104. package/dist/okta-auth-js.umd.js +2 -74
  105. package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
  106. package/dist/okta-auth-js.umd.js.map +1 -1
  107. package/esm/index.js +8368 -16
  108. package/esm/index.js.map +1 -1
  109. package/lib/OktaAuth.d.ts +7 -3
  110. package/lib/StorageManager.d.ts +1 -0
  111. package/lib/TransactionManager.d.ts +5 -1
  112. package/lib/constants.d.ts +1 -0
  113. package/lib/crypto/base64.d.ts +2 -2
  114. package/lib/crypto/oidcHash.d.ts +1 -1
  115. package/lib/crypto/verifyToken.d.ts +1 -1
  116. package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
  117. package/lib/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.d.ts +0 -0
  118. package/lib/idx/{flowMonitors → flow}/FlowMonitor.d.ts +0 -0
  119. package/lib/idx/flow/FlowSpecification.d.ts +10 -0
  120. package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
  121. package/lib/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.d.ts +0 -0
  122. package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
  123. package/lib/idx/{flowMonitors → flow}/RegistrationFlowMonitor.d.ts +0 -0
  124. package/lib/idx/flow/RemediationFlow.d.ts +13 -0
  125. package/lib/idx/{flowMonitors → flow}/index.d.ts +7 -2
  126. package/lib/idx/index.d.ts +2 -0
  127. package/lib/idx/introspect.d.ts +2 -1
  128. package/{esm/errors/AuthApiError.js → lib/idx/proceed.d.ts} +9 -19
  129. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +1 -4
  130. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +1 -4
  131. package/lib/idx/remediators/Identify.d.ts +1 -0
  132. package/lib/idx/run.d.ts +9 -9
  133. package/lib/idx/transactionMeta.d.ts +28 -4
  134. package/lib/idx/types/FlowIdentifier.d.ts +1 -0
  135. package/lib/idx/types/idx-js.d.ts +4 -0
  136. package/lib/idx/types/index.d.ts +14 -3
  137. package/lib/oidc/getToken.d.ts +2 -2
  138. package/lib/oidc/renewTokens.d.ts +0 -12
  139. package/lib/oidc/util/loginRedirect.d.ts +1 -1
  140. package/lib/types/OktaAuthOptions.d.ts +2 -0
  141. package/lib/types/Transaction.d.ts +2 -0
  142. package/lib/types/api.d.ts +20 -5
  143. package/{esm/errors/AuthPollStopError.js → lib/util/emailVerify.d.ts} +5 -8
  144. package/lib/util/index.d.ts +1 -0
  145. package/package.json +26 -14
  146. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  147. package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
  148. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  149. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  150. package/cjs/idx/flowMonitors/index.js +0 -54
  151. package/cjs/idx/flowMonitors/index.js.map +0 -1
  152. package/esm/AuthStateManager.js +0 -214
  153. package/esm/AuthStateManager.js.map +0 -1
  154. package/esm/OktaAuth.js +0 -679
  155. package/esm/OktaAuth.js.map +0 -1
  156. package/esm/OktaUserAgent.js +0 -49
  157. package/esm/OktaUserAgent.js.map +0 -1
  158. package/esm/PromiseQueue.js +0 -71
  159. package/esm/PromiseQueue.js.map +0 -1
  160. package/esm/SavedObject.js +0 -91
  161. package/esm/SavedObject.js.map +0 -1
  162. package/esm/StorageManager.js +0 -182
  163. package/esm/StorageManager.js.map +0 -1
  164. package/esm/TokenManager.js +0 -455
  165. package/esm/TokenManager.js.map +0 -1
  166. package/esm/TransactionManager.js +0 -316
  167. package/esm/TransactionManager.js.map +0 -1
  168. package/esm/browser/browserStorage.js +0 -256
  169. package/esm/browser/browserStorage.js.map +0 -1
  170. package/esm/browser/fingerprint.js +0 -74
  171. package/esm/browser/fingerprint.js.map +0 -1
  172. package/esm/builderUtil.js +0 -50
  173. package/esm/builderUtil.js.map +0 -1
  174. package/esm/clock.js.map +0 -1
  175. package/esm/constants.js +0 -35
  176. package/esm/constants.js.map +0 -1
  177. package/esm/crypto/base64.js +0 -66
  178. package/esm/crypto/base64.js.map +0 -1
  179. package/esm/crypto/browser.js.map +0 -1
  180. package/esm/crypto/index.js.map +0 -1
  181. package/esm/crypto/node.js +0 -54
  182. package/esm/crypto/node.js.map +0 -1
  183. package/esm/crypto/oidcHash.js +0 -27
  184. package/esm/crypto/oidcHash.js.map +0 -1
  185. package/esm/crypto/verifyToken.js +0 -39
  186. package/esm/crypto/verifyToken.js.map +0 -1
  187. package/esm/crypto/webcrypto.js.map +0 -1
  188. package/esm/errors/AuthApiError.js.map +0 -1
  189. package/esm/errors/AuthPollStopError.js.map +0 -1
  190. package/esm/errors/AuthSdkError.js +0 -29
  191. package/esm/errors/AuthSdkError.js.map +0 -1
  192. package/esm/errors/CustomError.js +0 -21
  193. package/esm/errors/CustomError.js.map +0 -1
  194. package/esm/errors/OAuthError.js +0 -22
  195. package/esm/errors/OAuthError.js.map +0 -1
  196. package/esm/errors/index.js +0 -22
  197. package/esm/errors/index.js.map +0 -1
  198. package/esm/features.js +0 -64
  199. package/esm/features.js.map +0 -1
  200. package/esm/fetch/fetchRequest.js +0 -92
  201. package/esm/fetch/fetchRequest.js.map +0 -1
  202. package/esm/http/headers.js +0 -17
  203. package/esm/http/headers.js.map +0 -1
  204. package/esm/http/index.js +0 -3
  205. package/esm/http/index.js.map +0 -1
  206. package/esm/http/request.js +0 -145
  207. package/esm/http/request.js.map +0 -1
  208. package/esm/idx/authenticate.js +0 -47
  209. package/esm/idx/authenticate.js.map +0 -1
  210. package/esm/idx/cancel.js +0 -32
  211. package/esm/idx/cancel.js.map +0 -1
  212. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
  213. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  214. package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
  215. package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
  216. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
  217. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  218. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
  219. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  220. package/esm/idx/flowMonitors/index.js +0 -16
  221. package/esm/idx/flowMonitors/index.js.map +0 -1
  222. package/esm/idx/handleInteractionCodeRedirect.js +0 -64
  223. package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
  224. package/esm/idx/headers.js +0 -39
  225. package/esm/idx/headers.js.map +0 -1
  226. package/esm/idx/index.js +0 -20
  227. package/esm/idx/index.js.map +0 -1
  228. package/esm/idx/interact.js +0 -83
  229. package/esm/idx/interact.js.map +0 -1
  230. package/esm/idx/introspect.js +0 -45
  231. package/esm/idx/introspect.js.map +0 -1
  232. package/esm/idx/recoverPassword.js +0 -46
  233. package/esm/idx/recoverPassword.js.map +0 -1
  234. package/esm/idx/register.js +0 -63
  235. package/esm/idx/register.js.map +0 -1
  236. package/esm/idx/remediate.js +0 -302
  237. package/esm/idx/remediate.js.map +0 -1
  238. package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
  239. package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
  240. package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
  241. package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
  242. package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
  243. package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
  244. package/esm/idx/remediators/Base/Remediator.js +0 -221
  245. package/esm/idx/remediators/Base/Remediator.js.map +0 -1
  246. package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
  247. package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
  248. package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -63
  249. package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
  250. package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
  251. package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
  252. package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
  253. package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
  254. package/esm/idx/remediators/EnrollProfile.js +0 -79
  255. package/esm/idx/remediators/EnrollProfile.js.map +0 -1
  256. package/esm/idx/remediators/Identify.js +0 -86
  257. package/esm/idx/remediators/Identify.js.map +0 -1
  258. package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
  259. package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
  260. package/esm/idx/remediators/RedirectIdp.js +0 -38
  261. package/esm/idx/remediators/RedirectIdp.js.map +0 -1
  262. package/esm/idx/remediators/ResetAuthenticator.js +0 -18
  263. package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
  264. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
  265. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
  266. package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
  267. package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
  268. package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
  269. package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
  270. package/esm/idx/remediators/Skip.js +0 -23
  271. package/esm/idx/remediators/Skip.js.map +0 -1
  272. package/esm/idx/remediators/index.js +0 -26
  273. package/esm/idx/remediators/index.js.map +0 -1
  274. package/esm/idx/remediators/util.js +0 -35
  275. package/esm/idx/remediators/util.js.map +0 -1
  276. package/esm/idx/run.js +0 -201
  277. package/esm/idx/run.js.map +0 -1
  278. package/esm/idx/startTransaction.js +0 -27
  279. package/esm/idx/startTransaction.js.map +0 -1
  280. package/esm/idx/transactionMeta.js +0 -114
  281. package/esm/idx/transactionMeta.js.map +0 -1
  282. package/esm/idx/types/idx-js.js +0 -17
  283. package/esm/idx/types/idx-js.js.map +0 -1
  284. package/esm/idx/types/index.js +0 -44
  285. package/esm/idx/types/index.js.map +0 -1
  286. package/esm/oidc/decodeToken.js +0 -31
  287. package/esm/oidc/decodeToken.js.map +0 -1
  288. package/esm/oidc/endpoints/authorize.js +0 -61
  289. package/esm/oidc/endpoints/authorize.js.map +0 -1
  290. package/esm/oidc/endpoints/index.js.map +0 -1
  291. package/esm/oidc/endpoints/token.js +0 -97
  292. package/esm/oidc/endpoints/token.js.map +0 -1
  293. package/esm/oidc/endpoints/well-known.js +0 -58
  294. package/esm/oidc/endpoints/well-known.js.map +0 -1
  295. package/esm/oidc/exchangeCodeForTokens.js +0 -69
  296. package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
  297. package/esm/oidc/getToken.js +0 -175
  298. package/esm/oidc/getToken.js.map +0 -1
  299. package/esm/oidc/getUserInfo.js +0 -82
  300. package/esm/oidc/getUserInfo.js.map +0 -1
  301. package/esm/oidc/getWithPopup.js +0 -28
  302. package/esm/oidc/getWithPopup.js.map +0 -1
  303. package/esm/oidc/getWithRedirect.js +0 -65
  304. package/esm/oidc/getWithRedirect.js.map +0 -1
  305. package/esm/oidc/getWithoutPrompt.js +0 -29
  306. package/esm/oidc/getWithoutPrompt.js.map +0 -1
  307. package/esm/oidc/handleOAuthResponse.js +0 -148
  308. package/esm/oidc/handleOAuthResponse.js.map +0 -1
  309. package/esm/oidc/index.js +0 -29
  310. package/esm/oidc/index.js.map +0 -1
  311. package/esm/oidc/parseFromUrl.js +0 -144
  312. package/esm/oidc/parseFromUrl.js.map +0 -1
  313. package/esm/oidc/renewToken.js +0 -85
  314. package/esm/oidc/renewToken.js.map +0 -1
  315. package/esm/oidc/renewTokens.js +0 -52
  316. package/esm/oidc/renewTokens.js.map +0 -1
  317. package/esm/oidc/renewTokensWithRefresh.js +0 -55
  318. package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
  319. package/esm/oidc/revokeToken.js +0 -57
  320. package/esm/oidc/revokeToken.js.map +0 -1
  321. package/esm/oidc/util/browser.js +0 -85
  322. package/esm/oidc/util/browser.js.map +0 -1
  323. package/esm/oidc/util/defaultTokenParams.js +0 -42
  324. package/esm/oidc/util/defaultTokenParams.js.map +0 -1
  325. package/esm/oidc/util/errors.js +0 -31
  326. package/esm/oidc/util/errors.js.map +0 -1
  327. package/esm/oidc/util/index.js +0 -25
  328. package/esm/oidc/util/index.js.map +0 -1
  329. package/esm/oidc/util/loginRedirect.js +0 -84
  330. package/esm/oidc/util/loginRedirect.js.map +0 -1
  331. package/esm/oidc/util/oauth.js +0 -70
  332. package/esm/oidc/util/oauth.js.map +0 -1
  333. package/esm/oidc/util/pkce.js +0 -55
  334. package/esm/oidc/util/pkce.js.map +0 -1
  335. package/esm/oidc/util/prepareTokenParams.js +0 -75
  336. package/esm/oidc/util/prepareTokenParams.js.map +0 -1
  337. package/esm/oidc/util/refreshToken.js +0 -24
  338. package/esm/oidc/util/refreshToken.js.map +0 -1
  339. package/esm/oidc/util/urlParams.js +0 -54
  340. package/esm/oidc/util/urlParams.js.map +0 -1
  341. package/esm/oidc/util/validateClaims.js +0 -53
  342. package/esm/oidc/util/validateClaims.js.map +0 -1
  343. package/esm/oidc/util/validateToken.js +0 -21
  344. package/esm/oidc/util/validateToken.js.map +0 -1
  345. package/esm/oidc/verifyToken.js +0 -78
  346. package/esm/oidc/verifyToken.js.map +0 -1
  347. package/esm/options.js +0 -134
  348. package/esm/options.js.map +0 -1
  349. package/esm/server/serverStorage.js +0 -110
  350. package/esm/server/serverStorage.js.map +0 -1
  351. package/esm/services/TokenService.js +0 -103
  352. package/esm/services/TokenService.js.map +0 -1
  353. package/esm/session.js +0 -81
  354. package/esm/session.js.map +0 -1
  355. package/esm/tx/AuthTransaction.js +0 -215
  356. package/esm/tx/AuthTransaction.js.map +0 -1
  357. package/esm/tx/TransactionState.js.map +0 -1
  358. package/esm/tx/api.js +0 -84
  359. package/esm/tx/api.js.map +0 -1
  360. package/esm/tx/index.js +0 -18
  361. package/esm/tx/index.js.map +0 -1
  362. package/esm/tx/poll.js +0 -124
  363. package/esm/tx/poll.js.map +0 -1
  364. package/esm/tx/util.js +0 -26
  365. package/esm/tx/util.js.map +0 -1
  366. package/esm/types/AuthState.js +0 -3
  367. package/esm/types/Cookies.js +0 -3
  368. package/esm/types/EventEmitter.js +0 -3
  369. package/esm/types/EventEmitter.js.map +0 -1
  370. package/esm/types/JWT.js +0 -3
  371. package/esm/types/JWT.js.map +0 -1
  372. package/esm/types/OAuth.js +0 -3
  373. package/esm/types/OAuth.js.map +0 -1
  374. package/esm/types/OktaAuthOptions.js +0 -3
  375. package/esm/types/OktaAuthOptions.js.map +0 -1
  376. package/esm/types/Storage.js +0 -3
  377. package/esm/types/Storage.js.map +0 -1
  378. package/esm/types/Token.js +0 -29
  379. package/esm/types/Token.js.map +0 -1
  380. package/esm/types/TokenManager.js +0 -3
  381. package/esm/types/TokenManager.js.map +0 -1
  382. package/esm/types/Transaction.js +0 -57
  383. package/esm/types/Transaction.js.map +0 -1
  384. package/esm/types/UserClaims.js +0 -3
  385. package/esm/types/UserClaims.js.map +0 -1
  386. package/esm/types/api.js +0 -3
  387. package/esm/types/api.js.map +0 -1
  388. package/esm/types/http.js +0 -3
  389. package/esm/types/http.js.map +0 -1
  390. package/esm/types/index.js +0 -27
  391. package/esm/types/index.js.map +0 -1
  392. package/esm/util/console.js +0 -53
  393. package/esm/util/console.js.map +0 -1
  394. package/esm/util/index.js +0 -17
  395. package/esm/util/index.js.map +0 -1
  396. package/esm/util/misc.js +0 -33
  397. package/esm/util/misc.js.map +0 -1
  398. package/esm/util/object.js +0 -117
  399. package/esm/util/object.js.map +0 -1
  400. package/esm/util/sharedStorage.js +0 -43
  401. package/esm/util/sharedStorage.js.map +0 -1
  402. package/esm/util/types.js +0 -27
  403. package/esm/util/types.js.map +0 -1
  404. package/esm/util/url.js +0 -64
  405. package/esm/util/url.js.map +0 -1
package/esm/OktaAuth.js DELETED
@@ -1,679 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- var _excluded = ["originalUri"];
5
-
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
-
8
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
-
10
- /* eslint-disable max-statements */
11
-
12
- /* eslint-disable complexity */
13
-
14
- /*!
15
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
16
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
17
- *
18
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
19
- * Unless required by applicable law or agreed to in writing, software
20
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- *
23
- * See the License for the specific language governing permissions and limitations under the License.
24
- */
25
-
26
- /* SDK_VERSION is defined in webpack config */
27
-
28
- /* global window, SDK_VERSION */
29
- import { DEFAULT_MAX_CLOCK_SKEW, REFERRER_PATH_STORAGE_KEY } from './constants';
30
- import * as constants from './constants';
31
- import { transactionStatus, resumeTransaction, transactionExists, introspect, postToTransaction } from './tx';
32
- import PKCE from './oidc/util/pkce';
33
- import { closeSession, sessionExists, getSession, refreshSession, setCookieAndRedirect } from './session';
34
- import { getOAuthUrls, getWithoutPrompt, getWithPopup, getWithRedirect, isLoginRedirect, parseFromUrl, decodeToken, revokeToken, renewToken, renewTokens, renewTokensWithRefresh, getUserInfo, verifyToken, prepareTokenParams, exchangeCodeForTokens, isInteractionRequiredError, isInteractionRequired } from './oidc';
35
- import { isBrowser } from './features';
36
- import * as features from './features';
37
- import browserStorage from './browser/browserStorage';
38
- import { toQueryString, toAbsoluteUrl, clone } from './util';
39
- import { getUserAgent } from './builderUtil';
40
- import { TokenManager } from './TokenManager';
41
- import { get, setRequestHeader } from './http';
42
- import PromiseQueue from './PromiseQueue';
43
- import fingerprint from './browser/fingerprint';
44
- import { AuthStateManager } from './AuthStateManager';
45
- import StorageManager from './StorageManager';
46
- import TransactionManager from './TransactionManager';
47
- import { buildOptions } from './options';
48
- import { interact, introspect as introspectV2, authenticate, cancel, register, recoverPassword, startTransaction, handleInteractionCodeRedirect } from './idx';
49
- import { createGlobalRequestInterceptor, setGlobalRequestInterceptor } from './idx/headers';
50
- import { OktaUserAgent } from './OktaUserAgent';
51
- import { parseOAuthResponseFromUrl } from './oidc/parseFromUrl';
52
-
53
- var Emitter = require('tiny-emitter');
54
-
55
- class OktaAuth {
56
- // keep this field to compatible with released downstream SDK versions
57
- // TODO: remove in version 6
58
- // JIRA: https://oktainc.atlassian.net/browse/OKTA-419417
59
- constructor(args) {
60
- this.options = buildOptions(args);
61
- var {
62
- storageManager,
63
- cookies,
64
- storageUtil
65
- } = this.options;
66
- this.storageManager = new StorageManager(storageManager, cookies, storageUtil);
67
- this.transactionManager = new TransactionManager(Object.assign({
68
- storageManager: this.storageManager
69
- }, args.transactionManager));
70
- this._oktaUserAgent = new OktaUserAgent();
71
- this.tx = {
72
- status: transactionStatus.bind(null, this),
73
- resume: resumeTransaction.bind(null, this),
74
- exists: Object.assign(transactionExists.bind(null, this), {
75
- _get: name => {
76
- var storage = storageUtil.storage;
77
- return storage.get(name);
78
- }
79
- }),
80
- introspect: introspect.bind(null, this)
81
- };
82
- this.pkce = {
83
- DEFAULT_CODE_CHALLENGE_METHOD: PKCE.DEFAULT_CODE_CHALLENGE_METHOD,
84
- generateVerifier: PKCE.generateVerifier,
85
- computeChallenge: PKCE.computeChallenge
86
- }; // Add shims for compatibility, these will be removed in next major version. OKTA-362589
87
-
88
- Object.assign(this.options.storageUtil, {
89
- getPKCEStorage: this.storageManager.getLegacyPKCEStorage.bind(this.storageManager),
90
- getHttpCache: this.storageManager.getHttpCache.bind(this.storageManager)
91
- });
92
- this._pending = {
93
- handleLogin: false
94
- };
95
-
96
- if (isBrowser()) {
97
- this.options = Object.assign(this.options, {
98
- redirectUri: toAbsoluteUrl(args.redirectUri, window.location.origin) // allow relative URIs
99
-
100
- });
101
- this.userAgent = getUserAgent(args, "okta-auth-js/".concat("5.6.0"));
102
- } else {
103
- this.userAgent = getUserAgent(args, "okta-auth-js-server/".concat("5.6.0"));
104
- } // Digital clocks will drift over time, so the server
105
- // can misalign with the time reported by the browser.
106
- // The maxClockSkew allows relaxing the time-based
107
- // validation of tokens (in seconds, not milliseconds).
108
- // It currently defaults to 300, because 5 min is the
109
- // default maximum tolerance allowed by Kerberos.
110
- // (https://technet.microsoft.com/en-us/library/cc976357.aspx)
111
-
112
-
113
- if (!args.maxClockSkew && args.maxClockSkew !== 0) {
114
- this.options.maxClockSkew = DEFAULT_MAX_CLOCK_SKEW;
115
- } else {
116
- this.options.maxClockSkew = args.maxClockSkew;
117
- } // As some end user's devices can have their date
118
- // and time incorrectly set, allow for the disabling
119
- // of the jwt liftetime validation
120
-
121
-
122
- this.options.ignoreLifetime = !!args.ignoreLifetime;
123
- this.session = {
124
- close: closeSession.bind(null, this),
125
- exists: sessionExists.bind(null, this),
126
- get: getSession.bind(null, this),
127
- refresh: refreshSession.bind(null, this),
128
- setCookieAndRedirect: setCookieAndRedirect.bind(null, this)
129
- };
130
- this._tokenQueue = new PromiseQueue();
131
- this.token = {
132
- prepareTokenParams: prepareTokenParams.bind(null, this),
133
- exchangeCodeForTokens: exchangeCodeForTokens.bind(null, this),
134
- getWithoutPrompt: getWithoutPrompt.bind(null, this),
135
- getWithPopup: getWithPopup.bind(null, this),
136
- getWithRedirect: getWithRedirect.bind(null, this),
137
- parseFromUrl: parseFromUrl.bind(null, this),
138
- decode: decodeToken,
139
- revoke: revokeToken.bind(null, this),
140
- renew: renewToken.bind(null, this),
141
- renewTokensWithRefresh: renewTokensWithRefresh.bind(null, this),
142
- renewTokens: renewTokens.bind(null, this),
143
- getUserInfo: getUserInfo.bind(null, this),
144
- verify: verifyToken.bind(null, this),
145
- isLoginRedirect: isLoginRedirect.bind(null, this)
146
- }; // Wrap all async token API methods using MethodQueue to avoid issues with concurrency
147
-
148
- var syncMethods = ['decode', 'isLoginRedirect'];
149
- Object.keys(this.token).forEach(key => {
150
- if (syncMethods.indexOf(key) >= 0) {
151
- // sync methods should not be wrapped
152
- return;
153
- }
154
-
155
- var method = this.token[key];
156
- this.token[key] = PromiseQueue.prototype.push.bind(this._tokenQueue, method, null);
157
- });
158
- Object.assign(this.token.getWithRedirect, {
159
- // This is exposed so we can set window.location in our tests
160
- _setLocation: function _setLocation(url) {
161
- window.location = url;
162
- }
163
- });
164
- Object.assign(this.token.parseFromUrl, {
165
- // This is exposed so we can mock getting window.history in our tests
166
- _getHistory: function _getHistory() {
167
- return window.history;
168
- },
169
- // This is exposed so we can mock getting window.location in our tests
170
- _getLocation: function _getLocation() {
171
- return window.location;
172
- },
173
- // This is exposed so we can mock getting window.document in our tests
174
- _getDocument: function _getDocument() {
175
- return window.document;
176
- }
177
- }); // IDX
178
-
179
- this.idx = {
180
- interact: interact.bind(null, this),
181
- introspect: introspectV2.bind(null, this),
182
- authenticate: authenticate.bind(null, this),
183
- register: register.bind(null, this),
184
- cancel: cancel.bind(null, this),
185
- recoverPassword: recoverPassword.bind(null, this),
186
- handleInteractionCodeRedirect: handleInteractionCodeRedirect.bind(null, this),
187
- startTransaction: startTransaction.bind(null, this)
188
- };
189
- setGlobalRequestInterceptor(createGlobalRequestInterceptor(this)); // to pass custom headers to IDX endpoints
190
- // HTTP
191
-
192
- this.http = {
193
- setRequestHeader: setRequestHeader.bind(null, this)
194
- }; // Fingerprint API
195
-
196
- this.fingerprint = fingerprint.bind(null, this);
197
- this.emitter = new Emitter(); // TokenManager
198
-
199
- this.tokenManager = new TokenManager(this, args.tokenManager); // AuthStateManager
200
-
201
- this.authStateManager = new AuthStateManager(this);
202
- }
203
-
204
- start() {
205
- this.tokenManager.start();
206
-
207
- if (!this.token.isLoginRedirect()) {
208
- this.authStateManager.updateAuthState();
209
- }
210
- }
211
-
212
- stop() {
213
- this.tokenManager.stop();
214
- } // ES6 module users can use named exports to access all symbols
215
- // CommonJS module users (CDN) need all exports on this object
216
- // Utility methods for interaction code flow
217
-
218
-
219
- isInteractionRequired() {
220
- return isInteractionRequired(this);
221
- }
222
-
223
- isInteractionRequiredError(error) {
224
- return isInteractionRequiredError(error);
225
- }
226
-
227
- signIn(opts) {
228
- var _this = this;
229
-
230
- return _asyncToGenerator(function* () {
231
- // TODO: support interaction code flow
232
- // Authn V1 flow
233
- return _this.signInWithCredentials(opts);
234
- })();
235
- }
236
-
237
- signInWithCredentials(opts) {
238
- var _this2 = this;
239
-
240
- return _asyncToGenerator(function* () {
241
- opts = clone(opts || {});
242
-
243
- var _postToTransaction = options => {
244
- options = options || {};
245
- options.withCredentials = true;
246
- delete opts.sendFingerprint;
247
- return postToTransaction(_this2, '/api/v1/authn', opts, options);
248
- };
249
-
250
- if (!opts.sendFingerprint) {
251
- return _postToTransaction();
252
- }
253
-
254
- return _this2.fingerprint().then(function (fingerprint) {
255
- return _postToTransaction({
256
- headers: {
257
- 'X-Device-Fingerprint': fingerprint
258
- }
259
- });
260
- });
261
- })();
262
- }
263
-
264
- signInWithRedirect() {
265
- var _arguments = arguments,
266
- _this3 = this;
267
-
268
- return _asyncToGenerator(function* () {
269
- var opts = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};
270
-
271
- var {
272
- originalUri
273
- } = opts,
274
- additionalParams = _objectWithoutProperties(opts, _excluded);
275
-
276
- if (_this3._pending.handleLogin) {
277
- // Don't trigger second round
278
- return;
279
- }
280
-
281
- _this3._pending.handleLogin = true;
282
-
283
- try {
284
- // Trigger default signIn redirect flow
285
- if (originalUri) {
286
- _this3.setOriginalUri(originalUri);
287
- }
288
-
289
- var params = Object.assign({
290
- // TODO: remove this line when default scopes are changed OKTA-343294
291
- scopes: _this3.options.scopes || ['openid', 'email', 'profile']
292
- }, additionalParams);
293
- yield _this3.token.getWithRedirect(params);
294
- } finally {
295
- _this3._pending.handleLogin = false;
296
- }
297
- })();
298
- } // Ends the current Okta SSO session without redirecting to Okta.
299
-
300
-
301
- closeSession() {
302
- // Clear all local tokens
303
- this.tokenManager.clear();
304
- return this.session.close() // DELETE /api/v1/sessions/me
305
- .catch(function (e) {
306
- if (e.name === 'AuthApiError' && e.errorCode === 'E0000007') {
307
- // Session does not exist or has already been closed
308
- return null;
309
- }
310
-
311
- throw e;
312
- });
313
- } // Revokes the access token for the application session
314
-
315
-
316
- revokeAccessToken(accessToken) {
317
- var _this4 = this;
318
-
319
- return _asyncToGenerator(function* () {
320
- if (!accessToken) {
321
- accessToken = (yield _this4.tokenManager.getTokens()).accessToken;
322
-
323
- var accessTokenKey = _this4.tokenManager.getStorageKeyByType('accessToken');
324
-
325
- _this4.tokenManager.remove(accessTokenKey);
326
- } // Access token may have been removed. In this case, we will silently succeed.
327
-
328
-
329
- if (!accessToken) {
330
- return Promise.resolve(null);
331
- }
332
-
333
- return _this4.token.revoke(accessToken);
334
- })();
335
- } // Revokes the refresh token for the application session
336
-
337
-
338
- revokeRefreshToken(refreshToken) {
339
- var _this5 = this;
340
-
341
- return _asyncToGenerator(function* () {
342
- if (!refreshToken) {
343
- refreshToken = (yield _this5.tokenManager.getTokens()).refreshToken;
344
-
345
- var refreshTokenKey = _this5.tokenManager.getStorageKeyByType('refreshToken');
346
-
347
- _this5.tokenManager.remove(refreshTokenKey);
348
- } // Refresh token may have been removed. In this case, we will silently succeed.
349
-
350
-
351
- if (!refreshToken) {
352
- return Promise.resolve(null);
353
- }
354
-
355
- return _this5.token.revoke(refreshToken);
356
- })();
357
- }
358
-
359
- getSignOutRedirectUrl() {
360
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
361
- var {
362
- idToken,
363
- postLogoutRedirectUri,
364
- state
365
- } = options;
366
-
367
- if (!idToken) {
368
- idToken = this.tokenManager.getTokensSync().idToken;
369
- }
370
-
371
- if (!idToken) {
372
- return '';
373
- }
374
-
375
- if (!postLogoutRedirectUri) {
376
- postLogoutRedirectUri = this.options.postLogoutRedirectUri;
377
- }
378
-
379
- var logoutUrl = getOAuthUrls(this).logoutUrl;
380
- var idTokenHint = idToken.idToken; // a string
381
-
382
- var logoutUri = logoutUrl + '?id_token_hint=' + encodeURIComponent(idTokenHint);
383
-
384
- if (postLogoutRedirectUri) {
385
- logoutUri += '&post_logout_redirect_uri=' + encodeURIComponent(postLogoutRedirectUri);
386
- } // State allows option parameters to be passed to logout redirect uri
387
-
388
-
389
- if (state) {
390
- logoutUri += '&state=' + encodeURIComponent(state);
391
- }
392
-
393
- return logoutUri;
394
- } // Revokes refreshToken or accessToken, clears all local tokens, then redirects to Okta to end the SSO session.
395
-
396
-
397
- signOut(options) {
398
- var _this6 = this;
399
-
400
- return _asyncToGenerator(function* () {
401
- options = Object.assign({}, options); // postLogoutRedirectUri must be whitelisted in Okta Admin UI
402
-
403
- var defaultUri = window.location.origin;
404
- var currentUri = window.location.href;
405
- var postLogoutRedirectUri = options.postLogoutRedirectUri || _this6.options.postLogoutRedirectUri || defaultUri;
406
- var accessToken = options.accessToken;
407
- var refreshToken = options.refreshToken;
408
- var revokeAccessToken = options.revokeAccessToken !== false;
409
- var revokeRefreshToken = options.revokeRefreshToken !== false;
410
-
411
- if (revokeRefreshToken && typeof refreshToken === 'undefined') {
412
- refreshToken = _this6.tokenManager.getTokensSync().refreshToken;
413
- }
414
-
415
- if (revokeAccessToken && typeof accessToken === 'undefined') {
416
- accessToken = _this6.tokenManager.getTokensSync().accessToken;
417
- }
418
-
419
- if (!options.idToken) {
420
- options.idToken = _this6.tokenManager.getTokensSync().idToken;
421
- } // Clear all local tokens
422
-
423
-
424
- _this6.tokenManager.clear();
425
-
426
- if (revokeRefreshToken && refreshToken) {
427
- yield _this6.revokeRefreshToken(refreshToken);
428
- }
429
-
430
- if (revokeAccessToken && accessToken) {
431
- yield _this6.revokeAccessToken(accessToken);
432
- }
433
-
434
- var logoutUri = _this6.getSignOutRedirectUrl(_objectSpread(_objectSpread({}, options), {}, {
435
- postLogoutRedirectUri
436
- })); // No logoutUri? This can happen if the storage was cleared.
437
- // Fallback to XHR signOut, then simulate a redirect to the post logout uri
438
-
439
-
440
- if (!logoutUri) {
441
- return _this6.closeSession() // can throw if the user cannot be signed out
442
- .then(function () {
443
- if (postLogoutRedirectUri === currentUri) {
444
- window.location.reload(); // force a hard reload if URI is not changing
445
- } else {
446
- window.location.assign(postLogoutRedirectUri);
447
- }
448
- });
449
- } else {
450
- // Flow ends with logout redirect
451
- window.location.assign(logoutUri);
452
- }
453
- })();
454
- }
455
-
456
- webfinger(opts) {
457
- var url = '/.well-known/webfinger' + toQueryString(opts);
458
- var options = {
459
- headers: {
460
- 'Accept': 'application/jrd+json'
461
- }
462
- };
463
- return get(this, url, options);
464
- } //
465
- // Common Methods from downstream SDKs
466
- //
467
- // Returns true if both accessToken and idToken are not expired
468
- // If `autoRenew` option is set, will attempt to renew expired tokens before returning.
469
-
470
-
471
- isAuthenticated() {
472
- var _this7 = this;
473
-
474
- return _asyncToGenerator(function* () {
475
- var {
476
- accessToken,
477
- idToken
478
- } = _this7.tokenManager.getTokensSync();
479
-
480
- var {
481
- autoRenew,
482
- autoRemove
483
- } = _this7.tokenManager.getOptions();
484
-
485
- if (accessToken && _this7.tokenManager.hasExpired(accessToken)) {
486
- accessToken = null;
487
-
488
- if (autoRenew) {
489
- accessToken = yield _this7.tokenManager.renew('accessToken');
490
- } else if (autoRemove) {
491
- _this7.tokenManager.remove('accessToken');
492
- }
493
- }
494
-
495
- if (idToken && _this7.tokenManager.hasExpired(idToken)) {
496
- idToken = null;
497
-
498
- if (autoRenew) {
499
- idToken = yield _this7.tokenManager.renew('idToken');
500
- } else if (autoRemove) {
501
- _this7.tokenManager.remove('idToken');
502
- }
503
- }
504
-
505
- return !!(accessToken && idToken);
506
- })();
507
- }
508
-
509
- getUser() {
510
- var _this8 = this;
511
-
512
- return _asyncToGenerator(function* () {
513
- var {
514
- idToken,
515
- accessToken
516
- } = _this8.tokenManager.getTokensSync();
517
-
518
- return _this8.token.getUserInfo(accessToken, idToken);
519
- })();
520
- }
521
-
522
- getIdToken() {
523
- var {
524
- idToken
525
- } = this.tokenManager.getTokensSync();
526
- return idToken ? idToken.idToken : undefined;
527
- }
528
-
529
- getAccessToken() {
530
- var {
531
- accessToken
532
- } = this.tokenManager.getTokensSync();
533
- return accessToken ? accessToken.accessToken : undefined;
534
- }
535
-
536
- getRefreshToken() {
537
- var {
538
- refreshToken
539
- } = this.tokenManager.getTokensSync();
540
- return refreshToken ? refreshToken.refreshToken : undefined;
541
- }
542
- /**
543
- * Store parsed tokens from redirect url
544
- */
545
-
546
-
547
- storeTokensFromRedirect() {
548
- var _this9 = this;
549
-
550
- return _asyncToGenerator(function* () {
551
- var {
552
- tokens
553
- } = yield _this9.token.parseFromUrl();
554
-
555
- _this9.tokenManager.setTokens(tokens);
556
- })();
557
- }
558
-
559
- setOriginalUri(originalUri) {
560
- var storage = browserStorage.getSessionStorage();
561
- storage.setItem(REFERRER_PATH_STORAGE_KEY, originalUri);
562
- }
563
-
564
- getOriginalUri(state) {
565
- if (state) {
566
- var meta = this.transactionManager.load({
567
- oauth: true,
568
- state
569
- });
570
- return meta.originalUri;
571
- }
572
-
573
- var storage = browserStorage.getSessionStorage();
574
- var originalUri = storage ? storage.getItem(REFERRER_PATH_STORAGE_KEY) : undefined;
575
- return originalUri;
576
- }
577
-
578
- removeOriginalUri() {
579
- var storage = browserStorage.getSessionStorage();
580
- storage.removeItem(REFERRER_PATH_STORAGE_KEY);
581
- }
582
-
583
- isLoginRedirect() {
584
- return isLoginRedirect(this);
585
- }
586
-
587
- handleLoginRedirect(tokens, originalUri) {
588
- var _this10 = this;
589
-
590
- return _asyncToGenerator(function* () {
591
- // Store tokens and update AuthState by the emitted events
592
- if (tokens) {
593
- _this10.tokenManager.setTokens(tokens);
594
-
595
- originalUri = originalUri || _this10.getOriginalUri();
596
- } else if (_this10.isLoginRedirect()) {
597
- // For redirect flow, get state from the URL and use it to retrieve the originalUri
598
- var {
599
- state
600
- } = yield parseOAuthResponseFromUrl(_this10, {});
601
- originalUri = originalUri || _this10.getOriginalUri(state);
602
- yield _this10.storeTokensFromRedirect();
603
- } else {
604
- return; // nothing to do
605
- } // ensure auth state has been updated
606
-
607
-
608
- yield _this10.authStateManager.updateAuthState(); // clear originalUri from storage
609
-
610
- _this10.removeOriginalUri(); // Redirect to originalUri
611
-
612
-
613
- var {
614
- restoreOriginalUri
615
- } = _this10.options;
616
-
617
- if (restoreOriginalUri) {
618
- yield restoreOriginalUri(_this10, originalUri);
619
- } else {
620
- window.location.replace(originalUri);
621
- }
622
- })();
623
- }
624
-
625
- isPKCE() {
626
- return !!this.options.pkce;
627
- }
628
-
629
- hasResponseType(responseType) {
630
- var hasResponseType = false;
631
-
632
- if (Array.isArray(this.options.responseType) && this.options.responseType.length) {
633
- hasResponseType = this.options.responseType.indexOf(responseType) >= 0;
634
- } else {
635
- hasResponseType = this.options.responseType === responseType;
636
- }
637
-
638
- return hasResponseType;
639
- }
640
-
641
- isAuthorizationCodeFlow() {
642
- return this.hasResponseType('code');
643
- } // { username, password, (relayState), (context) }
644
- // signIn(opts: SignInWithCredentialsOptions): Promise<AuthTransaction> {
645
- // return postToTransaction(this, '/api/v1/authn', opts);
646
- // }
647
-
648
-
649
- getIssuerOrigin() {
650
- // Infer the URL from the issuer URL, omitting the /oauth2/{authServerId}
651
- return this.options.issuer.split('/oauth2/')[0];
652
- } // { username, (relayState) }
653
-
654
-
655
- forgotPassword(opts) {
656
- return postToTransaction(this, '/api/v1/authn/recovery/password', opts);
657
- } // { username, (relayState) }
658
-
659
-
660
- unlockAccount(opts) {
661
- return postToTransaction(this, '/api/v1/authn/recovery/unlock', opts);
662
- } // { recoveryToken }
663
-
664
-
665
- verifyRecoveryToken(opts) {
666
- return postToTransaction(this, '/api/v1/authn/recovery/token', opts);
667
- }
668
-
669
- } // Hoist feature detection functions to static type
670
-
671
-
672
- OktaAuth.features = OktaAuth.prototype.features = features; // Also hoist values and utility functions for CommonJS users
673
-
674
- Object.assign(OktaAuth, {
675
- constants,
676
- isInteractionRequiredError
677
- });
678
- export default OktaAuth;
679
- //# sourceMappingURL=OktaAuth.js.map