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