@okta/okta-auth-js 7.6.0 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +142 -0
  3. package/cjs/base/types.js.map +1 -1
  4. package/cjs/errors/OAuthError.js +9 -1
  5. package/cjs/errors/OAuthError.js.map +1 -1
  6. package/cjs/errors/WWWAuthError.js +98 -0
  7. package/cjs/errors/WWWAuthError.js.map +1 -0
  8. package/cjs/errors/index.js +14 -1
  9. package/cjs/errors/index.js.map +1 -1
  10. package/cjs/features.js +10 -1
  11. package/cjs/features.js.map +1 -1
  12. package/cjs/http/OktaUserAgent.js +2 -2
  13. package/cjs/http/request.js +24 -25
  14. package/cjs/http/request.js.map +1 -1
  15. package/cjs/idx/IdxTransactionManager.js +5 -0
  16. package/cjs/idx/IdxTransactionManager.js.map +1 -1
  17. package/cjs/idx/run.js +6 -3
  18. package/cjs/idx/run.js.map +1 -1
  19. package/cjs/idx/types/options.js.map +1 -1
  20. package/cjs/oidc/dpop.js +231 -0
  21. package/cjs/oidc/dpop.js.map +1 -0
  22. package/cjs/oidc/endpoints/token.js +77 -27
  23. package/cjs/oidc/endpoints/token.js.map +1 -1
  24. package/cjs/oidc/exchangeCodeForTokens.js +51 -28
  25. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  26. package/cjs/oidc/getUserInfo.js +32 -17
  27. package/cjs/oidc/getUserInfo.js.map +1 -1
  28. package/cjs/oidc/handleOAuthResponse.js +12 -0
  29. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  30. package/cjs/oidc/mixin/index.js +63 -2
  31. package/cjs/oidc/mixin/index.js.map +1 -1
  32. package/cjs/oidc/options/OAuthOptionsConstructor.js +2 -0
  33. package/cjs/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  34. package/cjs/oidc/renewToken.js +4 -2
  35. package/cjs/oidc/renewToken.js.map +1 -1
  36. package/cjs/oidc/renewTokens.js +3 -1
  37. package/cjs/oidc/renewTokens.js.map +1 -1
  38. package/cjs/oidc/renewTokensWithRefresh.js +13 -2
  39. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  40. package/cjs/oidc/types/Token.js.map +1 -1
  41. package/cjs/oidc/types/api.js.map +1 -1
  42. package/cjs/oidc/types/options.js.map +1 -1
  43. package/cjs/oidc/util/defaultTokenParams.js +4 -2
  44. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  45. package/cjs/oidc/util/prepareTokenParams.js +3 -0
  46. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  47. package/dist/okta-auth-js.authn.min.analyzer.html +2 -2
  48. package/dist/okta-auth-js.authn.min.js +1 -1
  49. package/dist/okta-auth-js.authn.min.js.map +1 -1
  50. package/dist/okta-auth-js.core.min.analyzer.html +2 -2
  51. package/dist/okta-auth-js.core.min.js +1 -1
  52. package/dist/okta-auth-js.core.min.js.map +1 -1
  53. package/dist/okta-auth-js.idx.min.analyzer.html +2 -2
  54. package/dist/okta-auth-js.idx.min.js +1 -1
  55. package/dist/okta-auth-js.idx.min.js.map +1 -1
  56. package/dist/okta-auth-js.min.analyzer.html +2 -2
  57. package/dist/okta-auth-js.min.js +1 -1
  58. package/dist/okta-auth-js.min.js.map +1 -1
  59. package/dist/okta-auth-js.myaccount.min.analyzer.html +2 -2
  60. package/dist/okta-auth-js.myaccount.min.js +1 -1
  61. package/dist/okta-auth-js.myaccount.min.js.map +1 -1
  62. package/esm/browser/authn/api.js +1 -0
  63. package/esm/browser/authn/api.js.map +1 -1
  64. package/esm/browser/authn/util/link2fn.js +1 -0
  65. package/esm/browser/authn/util/link2fn.js.map +1 -1
  66. package/esm/browser/authn/util/poll.js +1 -0
  67. package/esm/browser/authn/util/poll.js.map +1 -1
  68. package/esm/browser/browser/fingerprint.js +1 -0
  69. package/esm/browser/browser/fingerprint.js.map +1 -1
  70. package/esm/browser/core/AuthStateManager.js +1 -0
  71. package/esm/browser/core/AuthStateManager.js.map +1 -1
  72. package/esm/browser/core/options.js +1 -0
  73. package/esm/browser/core/options.js.map +1 -1
  74. package/esm/browser/crypto/base64.js +1 -0
  75. package/esm/browser/crypto/base64.js.map +1 -1
  76. package/esm/browser/errors/OAuthError.js +5 -1
  77. package/esm/browser/errors/OAuthError.js.map +1 -1
  78. package/esm/browser/errors/WWWAuthError.js +61 -0
  79. package/esm/browser/errors/WWWAuthError.js.map +1 -0
  80. package/esm/browser/errors/index.js +6 -1
  81. package/esm/browser/errors/index.js.map +1 -1
  82. package/esm/browser/exports/exports/authn.js +2 -1
  83. package/esm/browser/exports/exports/authn.js.map +1 -1
  84. package/esm/browser/exports/exports/core.js +2 -1
  85. package/esm/browser/exports/exports/core.js.map +1 -1
  86. package/esm/browser/exports/exports/default.js +2 -1
  87. package/esm/browser/exports/exports/default.js.map +1 -1
  88. package/esm/browser/exports/exports/idx.js +2 -1
  89. package/esm/browser/exports/exports/idx.js.map +1 -1
  90. package/esm/browser/exports/exports/myaccount.js +2 -1
  91. package/esm/browser/exports/exports/myaccount.js.map +1 -1
  92. package/esm/browser/features.js +12 -2
  93. package/esm/browser/features.js.map +1 -1
  94. package/esm/browser/http/OktaUserAgent.js +2 -2
  95. package/esm/browser/http/options.js +1 -0
  96. package/esm/browser/http/options.js.map +1 -1
  97. package/esm/browser/http/request.js +14 -25
  98. package/esm/browser/http/request.js.map +1 -1
  99. package/esm/browser/idx/IdxTransactionManager.js +4 -1
  100. package/esm/browser/idx/IdxTransactionManager.js.map +1 -1
  101. package/esm/browser/idx/cancel.js +1 -0
  102. package/esm/browser/idx/cancel.js.map +1 -1
  103. package/esm/browser/idx/factory/api.js +1 -0
  104. package/esm/browser/idx/factory/api.js.map +1 -1
  105. package/esm/browser/idx/flow/AccountUnlockFlow.js +1 -0
  106. package/esm/browser/idx/flow/AccountUnlockFlow.js.map +1 -1
  107. package/esm/browser/idx/flow/AuthenticationFlow.js +1 -0
  108. package/esm/browser/idx/flow/AuthenticationFlow.js.map +1 -1
  109. package/esm/browser/idx/flow/PasswordRecoveryFlow.js +1 -0
  110. package/esm/browser/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  111. package/esm/browser/idx/flow/RegistrationFlow.js +1 -0
  112. package/esm/browser/idx/flow/RegistrationFlow.js.map +1 -1
  113. package/esm/browser/idx/handleInteractionCodeRedirect.js +1 -0
  114. package/esm/browser/idx/handleInteractionCodeRedirect.js.map +1 -1
  115. package/esm/browser/idx/idxState/v1/generateIdxAction.js +1 -0
  116. package/esm/browser/idx/idxState/v1/generateIdxAction.js.map +1 -1
  117. package/esm/browser/idx/idxState/v1/idxResponseParser.js +1 -0
  118. package/esm/browser/idx/idxState/v1/idxResponseParser.js.map +1 -1
  119. package/esm/browser/idx/interact.js +1 -0
  120. package/esm/browser/idx/interact.js.map +1 -1
  121. package/esm/browser/idx/proceed.js +1 -0
  122. package/esm/browser/idx/proceed.js.map +1 -1
  123. package/esm/browser/idx/recoverPassword.js +1 -0
  124. package/esm/browser/idx/recoverPassword.js.map +1 -1
  125. package/esm/browser/idx/register.js +1 -0
  126. package/esm/browser/idx/register.js.map +1 -1
  127. package/esm/browser/idx/remediate.js +1 -0
  128. package/esm/browser/idx/remediate.js.map +1 -1
  129. package/esm/browser/idx/remediators/GenericRemediator/util.js +2 -0
  130. package/esm/browser/idx/remediators/GenericRemediator/util.js.map +1 -1
  131. package/esm/browser/idx/run.js +3 -3
  132. package/esm/browser/idx/run.js.map +1 -1
  133. package/esm/browser/idx/transactionMeta.js +1 -0
  134. package/esm/browser/idx/transactionMeta.js.map +1 -1
  135. package/esm/browser/idx/unlockAccount.js +1 -0
  136. package/esm/browser/idx/unlockAccount.js.map +1 -1
  137. package/esm/browser/myaccount/request.js +1 -0
  138. package/esm/browser/myaccount/request.js.map +1 -1
  139. package/esm/browser/oidc/TokenManager.js +1 -0
  140. package/esm/browser/oidc/TokenManager.js.map +1 -1
  141. package/esm/browser/oidc/decodeToken.js +1 -0
  142. package/esm/browser/oidc/decodeToken.js.map +1 -1
  143. package/esm/browser/oidc/dpop.js +160 -0
  144. package/esm/browser/oidc/dpop.js.map +1 -0
  145. package/esm/browser/oidc/endpoints/authorize.js +1 -0
  146. package/esm/browser/oidc/endpoints/authorize.js.map +1 -1
  147. package/esm/browser/oidc/endpoints/token.js +57 -24
  148. package/esm/browser/oidc/endpoints/token.js.map +1 -1
  149. package/esm/browser/oidc/endpoints/well-known.js +1 -0
  150. package/esm/browser/oidc/endpoints/well-known.js.map +1 -1
  151. package/esm/browser/oidc/enrollAuthenticator.js +1 -0
  152. package/esm/browser/oidc/enrollAuthenticator.js.map +1 -1
  153. package/esm/browser/oidc/exchangeCodeForTokens.js +40 -25
  154. package/esm/browser/oidc/exchangeCodeForTokens.js.map +1 -1
  155. package/esm/browser/oidc/factory/api.js +1 -0
  156. package/esm/browser/oidc/factory/api.js.map +1 -1
  157. package/esm/browser/oidc/factory/baseApi.js +1 -0
  158. package/esm/browser/oidc/factory/baseApi.js.map +1 -1
  159. package/esm/browser/oidc/getToken.js +1 -0
  160. package/esm/browser/oidc/getToken.js.map +1 -1
  161. package/esm/browser/oidc/getUserInfo.js +22 -18
  162. package/esm/browser/oidc/getUserInfo.js.map +1 -1
  163. package/esm/browser/oidc/getWithPopup.js +1 -0
  164. package/esm/browser/oidc/getWithPopup.js.map +1 -1
  165. package/esm/browser/oidc/getWithRedirect.js +1 -0
  166. package/esm/browser/oidc/getWithRedirect.js.map +1 -1
  167. package/esm/browser/oidc/getWithoutPrompt.js +1 -0
  168. package/esm/browser/oidc/getWithoutPrompt.js.map +1 -1
  169. package/esm/browser/oidc/handleOAuthResponse.js +10 -0
  170. package/esm/browser/oidc/handleOAuthResponse.js.map +1 -1
  171. package/esm/browser/oidc/introspect.js +1 -0
  172. package/esm/browser/oidc/introspect.js.map +1 -1
  173. package/esm/browser/oidc/mixin/index.js +62 -2
  174. package/esm/browser/oidc/mixin/index.js.map +1 -1
  175. package/esm/browser/oidc/mixin/minimal.js +1 -0
  176. package/esm/browser/oidc/mixin/minimal.js.map +1 -1
  177. package/esm/browser/oidc/options/OAuthOptionsConstructor.js +1 -0
  178. package/esm/browser/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  179. package/esm/browser/oidc/parseFromUrl.js +1 -0
  180. package/esm/browser/oidc/parseFromUrl.js.map +1 -1
  181. package/esm/browser/oidc/renewToken.js +4 -2
  182. package/esm/browser/oidc/renewToken.js.map +1 -1
  183. package/esm/browser/oidc/renewTokens.js +4 -1
  184. package/esm/browser/oidc/renewTokens.js.map +1 -1
  185. package/esm/browser/oidc/renewTokensWithRefresh.js +12 -5
  186. package/esm/browser/oidc/renewTokensWithRefresh.js.map +1 -1
  187. package/esm/browser/oidc/revokeToken.js +1 -0
  188. package/esm/browser/oidc/revokeToken.js.map +1 -1
  189. package/esm/browser/oidc/storage.js +1 -0
  190. package/esm/browser/oidc/storage.js.map +1 -1
  191. package/esm/browser/oidc/types/Token.js.map +1 -1
  192. package/esm/browser/oidc/util/browser.js +1 -0
  193. package/esm/browser/oidc/util/browser.js.map +1 -1
  194. package/esm/browser/oidc/util/defaultTokenParams.js +3 -2
  195. package/esm/browser/oidc/util/defaultTokenParams.js.map +1 -1
  196. package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js +1 -0
  197. package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -1
  198. package/esm/browser/oidc/util/prepareTokenParams.js +4 -0
  199. package/esm/browser/oidc/util/prepareTokenParams.js.map +1 -1
  200. package/esm/browser/oidc/util/validateToken.js +1 -0
  201. package/esm/browser/oidc/util/validateToken.js.map +1 -1
  202. package/esm/browser/oidc/verifyToken.js +1 -0
  203. package/esm/browser/oidc/verifyToken.js.map +1 -1
  204. package/esm/browser/package.json +1 -1
  205. package/esm/browser/services/AutoRenewService.js +1 -0
  206. package/esm/browser/services/AutoRenewService.js.map +1 -1
  207. package/esm/browser/services/SyncStorageService.js +1 -0
  208. package/esm/browser/services/SyncStorageService.js.map +1 -1
  209. package/esm/browser/session/api.js +1 -0
  210. package/esm/browser/session/api.js.map +1 -1
  211. package/esm/node/authn/api.js +1 -0
  212. package/esm/node/authn/api.js.map +1 -1
  213. package/esm/node/authn/util/link2fn.js +1 -0
  214. package/esm/node/authn/util/link2fn.js.map +1 -1
  215. package/esm/node/authn/util/poll.js +1 -0
  216. package/esm/node/authn/util/poll.js.map +1 -1
  217. package/esm/node/browser/fingerprint.js +1 -0
  218. package/esm/node/browser/fingerprint.js.map +1 -1
  219. package/esm/node/core/AuthStateManager.js +1 -0
  220. package/esm/node/core/AuthStateManager.js.map +1 -1
  221. package/esm/node/core/options.js +1 -0
  222. package/esm/node/core/options.js.map +1 -1
  223. package/esm/node/crypto/base64.js +1 -0
  224. package/esm/node/crypto/base64.js.map +1 -1
  225. package/esm/node/errors/OAuthError.js +5 -1
  226. package/esm/node/errors/OAuthError.js.map +1 -1
  227. package/esm/node/errors/WWWAuthError.js +61 -0
  228. package/esm/node/errors/WWWAuthError.js.map +1 -0
  229. package/esm/node/errors/index.js +6 -1
  230. package/esm/node/errors/index.js.map +1 -1
  231. package/esm/node/exports/exports/authn.js +2 -1
  232. package/esm/node/exports/exports/authn.js.map +1 -1
  233. package/esm/node/exports/exports/core.js +2 -1
  234. package/esm/node/exports/exports/core.js.map +1 -1
  235. package/esm/node/exports/exports/default.js +2 -1
  236. package/esm/node/exports/exports/default.js.map +1 -1
  237. package/esm/node/exports/exports/idx.js +2 -1
  238. package/esm/node/exports/exports/idx.js.map +1 -1
  239. package/esm/node/exports/exports/myaccount.js +2 -1
  240. package/esm/node/exports/exports/myaccount.js.map +1 -1
  241. package/esm/node/features.js +12 -2
  242. package/esm/node/features.js.map +1 -1
  243. package/esm/node/http/OktaUserAgent.js +2 -2
  244. package/esm/node/http/options.js +1 -0
  245. package/esm/node/http/options.js.map +1 -1
  246. package/esm/node/http/request.js +14 -25
  247. package/esm/node/http/request.js.map +1 -1
  248. package/esm/node/idx/IdxTransactionManager.js +4 -1
  249. package/esm/node/idx/IdxTransactionManager.js.map +1 -1
  250. package/esm/node/idx/cancel.js +1 -0
  251. package/esm/node/idx/cancel.js.map +1 -1
  252. package/esm/node/idx/factory/api.js +1 -0
  253. package/esm/node/idx/factory/api.js.map +1 -1
  254. package/esm/node/idx/flow/AccountUnlockFlow.js +1 -0
  255. package/esm/node/idx/flow/AccountUnlockFlow.js.map +1 -1
  256. package/esm/node/idx/flow/AuthenticationFlow.js +1 -0
  257. package/esm/node/idx/flow/AuthenticationFlow.js.map +1 -1
  258. package/esm/node/idx/flow/PasswordRecoveryFlow.js +1 -0
  259. package/esm/node/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  260. package/esm/node/idx/flow/RegistrationFlow.js +1 -0
  261. package/esm/node/idx/flow/RegistrationFlow.js.map +1 -1
  262. package/esm/node/idx/handleInteractionCodeRedirect.js +1 -0
  263. package/esm/node/idx/handleInteractionCodeRedirect.js.map +1 -1
  264. package/esm/node/idx/idxState/v1/generateIdxAction.js +1 -0
  265. package/esm/node/idx/idxState/v1/generateIdxAction.js.map +1 -1
  266. package/esm/node/idx/idxState/v1/idxResponseParser.js +1 -0
  267. package/esm/node/idx/idxState/v1/idxResponseParser.js.map +1 -1
  268. package/esm/node/idx/interact.js +1 -0
  269. package/esm/node/idx/interact.js.map +1 -1
  270. package/esm/node/idx/proceed.js +1 -0
  271. package/esm/node/idx/proceed.js.map +1 -1
  272. package/esm/node/idx/recoverPassword.js +1 -0
  273. package/esm/node/idx/recoverPassword.js.map +1 -1
  274. package/esm/node/idx/register.js +1 -0
  275. package/esm/node/idx/register.js.map +1 -1
  276. package/esm/node/idx/remediate.js +1 -0
  277. package/esm/node/idx/remediate.js.map +1 -1
  278. package/esm/node/idx/remediators/GenericRemediator/util.js +2 -0
  279. package/esm/node/idx/remediators/GenericRemediator/util.js.map +1 -1
  280. package/esm/node/idx/run.js +3 -3
  281. package/esm/node/idx/run.js.map +1 -1
  282. package/esm/node/idx/transactionMeta.js +1 -0
  283. package/esm/node/idx/transactionMeta.js.map +1 -1
  284. package/esm/node/idx/unlockAccount.js +1 -0
  285. package/esm/node/idx/unlockAccount.js.map +1 -1
  286. package/esm/node/myaccount/request.js +1 -0
  287. package/esm/node/myaccount/request.js.map +1 -1
  288. package/esm/node/oidc/TokenManager.js +1 -0
  289. package/esm/node/oidc/TokenManager.js.map +1 -1
  290. package/esm/node/oidc/decodeToken.js +1 -0
  291. package/esm/node/oidc/decodeToken.js.map +1 -1
  292. package/esm/node/oidc/dpop.js +160 -0
  293. package/esm/node/oidc/dpop.js.map +1 -0
  294. package/esm/node/oidc/endpoints/authorize.js +1 -0
  295. package/esm/node/oidc/endpoints/authorize.js.map +1 -1
  296. package/esm/node/oidc/endpoints/token.js +57 -24
  297. package/esm/node/oidc/endpoints/token.js.map +1 -1
  298. package/esm/node/oidc/endpoints/well-known.js +1 -0
  299. package/esm/node/oidc/endpoints/well-known.js.map +1 -1
  300. package/esm/node/oidc/enrollAuthenticator.js +1 -0
  301. package/esm/node/oidc/enrollAuthenticator.js.map +1 -1
  302. package/esm/node/oidc/exchangeCodeForTokens.js +40 -25
  303. package/esm/node/oidc/exchangeCodeForTokens.js.map +1 -1
  304. package/esm/node/oidc/factory/api.js +1 -0
  305. package/esm/node/oidc/factory/api.js.map +1 -1
  306. package/esm/node/oidc/factory/baseApi.js +1 -0
  307. package/esm/node/oidc/factory/baseApi.js.map +1 -1
  308. package/esm/node/oidc/getToken.js +1 -0
  309. package/esm/node/oidc/getToken.js.map +1 -1
  310. package/esm/node/oidc/getUserInfo.js +22 -18
  311. package/esm/node/oidc/getUserInfo.js.map +1 -1
  312. package/esm/node/oidc/getWithPopup.js +1 -0
  313. package/esm/node/oidc/getWithPopup.js.map +1 -1
  314. package/esm/node/oidc/getWithRedirect.js +1 -0
  315. package/esm/node/oidc/getWithRedirect.js.map +1 -1
  316. package/esm/node/oidc/getWithoutPrompt.js +1 -0
  317. package/esm/node/oidc/getWithoutPrompt.js.map +1 -1
  318. package/esm/node/oidc/handleOAuthResponse.js +10 -0
  319. package/esm/node/oidc/handleOAuthResponse.js.map +1 -1
  320. package/esm/node/oidc/introspect.js +1 -0
  321. package/esm/node/oidc/introspect.js.map +1 -1
  322. package/esm/node/oidc/mixin/index.js +62 -2
  323. package/esm/node/oidc/mixin/index.js.map +1 -1
  324. package/esm/node/oidc/mixin/minimal.js +1 -0
  325. package/esm/node/oidc/mixin/minimal.js.map +1 -1
  326. package/esm/node/oidc/options/OAuthOptionsConstructor.js +1 -0
  327. package/esm/node/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  328. package/esm/node/oidc/parseFromUrl.js +1 -0
  329. package/esm/node/oidc/parseFromUrl.js.map +1 -1
  330. package/esm/node/oidc/renewToken.js +4 -2
  331. package/esm/node/oidc/renewToken.js.map +1 -1
  332. package/esm/node/oidc/renewTokens.js +4 -1
  333. package/esm/node/oidc/renewTokens.js.map +1 -1
  334. package/esm/node/oidc/renewTokensWithRefresh.js +12 -5
  335. package/esm/node/oidc/renewTokensWithRefresh.js.map +1 -1
  336. package/esm/node/oidc/revokeToken.js +1 -0
  337. package/esm/node/oidc/revokeToken.js.map +1 -1
  338. package/esm/node/oidc/storage.js +1 -0
  339. package/esm/node/oidc/storage.js.map +1 -1
  340. package/esm/node/oidc/types/Token.js.map +1 -1
  341. package/esm/node/oidc/util/browser.js +1 -0
  342. package/esm/node/oidc/util/browser.js.map +1 -1
  343. package/esm/node/oidc/util/defaultTokenParams.js +3 -2
  344. package/esm/node/oidc/util/defaultTokenParams.js.map +1 -1
  345. package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js +1 -0
  346. package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -1
  347. package/esm/node/oidc/util/prepareTokenParams.js +4 -0
  348. package/esm/node/oidc/util/prepareTokenParams.js.map +1 -1
  349. package/esm/node/oidc/util/validateToken.js +1 -0
  350. package/esm/node/oidc/util/validateToken.js.map +1 -1
  351. package/esm/node/oidc/verifyToken.js +1 -0
  352. package/esm/node/oidc/verifyToken.js.map +1 -1
  353. package/esm/node/package.json +1 -1
  354. package/esm/node/server/serverStorage.js +1 -0
  355. package/esm/node/server/serverStorage.js.map +1 -1
  356. package/esm/node/session/api.js +1 -0
  357. package/esm/node/session/api.js.map +1 -1
  358. package/esm/node/storage/options/StorageOptionsConstructor.js +1 -0
  359. package/esm/node/storage/options/StorageOptionsConstructor.js.map +1 -1
  360. package/package.json +4 -3
  361. package/types/lib/base/types.d.ts +1 -0
  362. package/types/lib/core/options.d.ts +1 -0
  363. package/types/lib/errors/OAuthError.d.ts +3 -1
  364. package/types/lib/errors/WWWAuthError.d.ts +29 -0
  365. package/types/lib/errors/index.d.ts +3 -1
  366. package/types/lib/features.d.ts +1 -0
  367. package/types/lib/idx/options.d.ts +1 -0
  368. package/types/lib/idx/types/options.d.ts +1 -0
  369. package/types/lib/oidc/dpop.d.ts +35 -0
  370. package/types/lib/oidc/endpoints/token.d.ts +5 -2
  371. package/types/lib/oidc/options/OAuthOptionsConstructor.d.ts +1 -0
  372. package/types/lib/oidc/types/Token.d.ts +2 -0
  373. package/types/lib/oidc/types/api.d.ts +13 -0
  374. package/types/lib/oidc/types/options.d.ts +3 -0
  375. package/umd/authn.js +1 -1
  376. package/umd/authn.js.map +1 -1
  377. package/umd/core.js +1 -1
  378. package/umd/core.js.map +1 -1
  379. package/umd/default.js +1 -1
  380. package/umd/default.js.map +1 -1
  381. package/umd/idx.js +1 -1
  382. package/umd/idx.js.map +1 -1
  383. package/umd/myaccount.js +1 -1
  384. package/umd/myaccount.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -4,8 +4,10 @@
4
4
 
5
5
  ### Features
6
6
 
7
+ - [#1495](https://github.com/okta/okta-auth-js/pull/1495) add: DPoP support
7
8
  - [#1507](https://github.com/okta/okta-auth-js/pull/1507) add: new method `getOrRenewAccessToken`
8
9
  - [#1505](https://github.com/okta/okta-auth-js/pull/1505) add: support of `revokeSessions` param for `OktaPassword` authenticator (can be used in `reset-authenticator` remediation)
10
+ - [#1508](https://github.com/okta/okta-auth-js/pull/1508) IDX: add condition to compare stateHandles when loading saved idxResponse only when useGenericRemediator option is false or undefined
9
11
  - [#1512](https://github.com/okta/okta-auth-js/pull/1512) add: new service `RenewOnTabActivation`
10
12
 
11
13
  ### Bug Fix
package/README.md CHANGED
@@ -399,6 +399,105 @@ Additionally, if using hash routing, we recommend using PKCE and responseMode "q
399
399
  2. Add tokens to the `TokenManager`: [tokenManager.setTokens](#tokenmanagersettokenstokens)
400
400
  6. Read saved route and redirect to it: [getOriginalUri](#getoriginaluristate)
401
401
 
402
+ ### Enabling DPoP
403
+ <sub><sup>*Reference: DPoP (Demonstrating Proof-of-Possession) - [RFC9449](https://datatracker.ietf.org/doc/html/rfc9449)*</sub></sup>
404
+
405
+ #### Requirements
406
+ * `DPoP` must be enabled in your Okta application ([Guide: Configure DPoP](https://developer.okta.com/docs/guides/dpop/main/))
407
+ * Only supported on web (browser)
408
+ * `https` is required. A [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) is required for `WebCrypto.subtle`
409
+ * Targeted browsers must support `IndexedDB` ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API), [caniuse](https://caniuse.com/indexeddb))
410
+ * :warning: IE11 (and lower) is not supported!
411
+
412
+ #### Configuration
413
+ ```javascript
414
+ const config = {
415
+ // other configurations
416
+ pkce: true, // required
417
+ dpop: true,
418
+ };
419
+
420
+ const authClient = new OktaAuth(config);
421
+ ```
422
+
423
+ #### Providing DPoP Proof to Resource Requests
424
+ <sub><sup>*Reference: **The DPoP Authentication Scheme** ([RFC9449](https://datatracker.ietf.org/doc/html/rfc9449#name-the-dpop-authentication-sch))*</sub></sup>
425
+
426
+ ##### DPoP-Protected Resource Request ([link](https://datatracker.ietf.org/doc/html/rfc9449#name-dpop-protected-resource-req))
427
+ ```
428
+ GET /protectedresource HTTP/1.1
429
+ Host: resource.example.org
430
+ Authorization: DPoP Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU
431
+ DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsIm...
432
+ ```
433
+
434
+ ##### Fetching DPoP-Protected Resource
435
+ ```javascript
436
+ async function dpopAuthenticatedFetch (url, options) {
437
+ const { method } = options;
438
+ const dpop = await authClient.getDPoPAuthorizationHeaders({ url, method });
439
+ // dpop = { Authorization: "DPoP token****", Dpop: "proof****" }
440
+ const headers = new Headers({...options.headers, ...dpop});
441
+ return fetch(url, {...options, headers });
442
+ }
443
+ ```
444
+
445
+ #### Handling `use_dpop_nonce`
446
+ <sub><sup>*Reference: **Resource Server-Provided Nonce** ([RFC9449](https://datatracker.ietf.org/doc/html/rfc9449#name-resource-server-provided-no))*</sub></sup>
447
+
448
+ > Resource servers can also choose to provide a nonce value to be included in DPoP proofs sent to them. They provide the nonce using the DPoP-Nonce header in the same way that authorization servers do...
449
+
450
+ ##### Resource Server Response
451
+ ```
452
+ HTTP/1.1 401 Unauthorized
453
+ WWW-Authenticate: DPoP error="use_dpop_nonce", \
454
+ error_description="Resource server requires nonce in DPoP proof"
455
+ DPoP-Nonce: eyJ7S_zG.eyJH0-Z.HX4w-7v
456
+ ```
457
+ ##### Handling Response
458
+ ```javascript
459
+ async function dpopAuthenticatedFetch (url, options) {
460
+ // ...previous example...
461
+ const resp = await fetch(url, {...options, headers });
462
+ // resp = HTTP/1.1 401 Unauthorized...
463
+
464
+ if (!resp.ok) {
465
+ const nonce = authClient.parseUseDPoPNonceError(resp.headers);
466
+ if (nonce) {
467
+ const retryDpop = await authClient.getDPoPAuthorizationHeaders({ url, method, nonce });
468
+ const retryHeaders = new Headers({...options.headers, ...retryDpop});
469
+ return fetch(url, {...options, headers: retryHeaders });
470
+ }
471
+ }
472
+
473
+ return resp;
474
+ }
475
+ ```
476
+
477
+ #### Ensure browser can support DPoP (*Recommended*)
478
+ DPoP requires certain browser features. A user using a browser without the required features will unable to complete a request for tokens. It's recommended to verify browser support during application bootstrapping.
479
+
480
+ ```javascript
481
+ // App.tsx
482
+ useEffect(() => {
483
+ if (!authClient.features.isDPoPSupported()) {
484
+ // user will be unable to request tokens
485
+ navigate('/unsupported-error-page');
486
+ }
487
+ }, []);
488
+ ```
489
+
490
+ #### Clear DPoP Storage (*Recommended*)
491
+ DPoP requires the generation of a `CryptoKeyPair` which needs to be persisted in storage. Methods like `signOut()` or `revokeAccessToken()` will clear the key pair, however users don't always explicitly logout. It's therefore good practice to clear storage before login to flush any orphaned key pairs generated from previously requested tokens.
492
+
493
+ ```javascript
494
+ async function login (options) {
495
+ await authClient.clearDPoPStorage(); // clear possibly orphaned key pairs
496
+
497
+ return authClient.signInWithRedirect(options);
498
+ }
499
+ ```
500
+
402
501
  ## Configuration reference
403
502
 
404
503
  Whether you are using this SDK to implement an OIDC flow or for communicating with the [Authentication API](https://developer.okta.com/docs/api/resources/authn), the only required configuration option is `issuer`, which is the URL to an Okta [Authorization Server](https://developer.okta.com/docs/guides/customize-authz-server/overview/)
@@ -470,6 +569,13 @@ A client-provided string that will be passed to the server endpoint and returned
470
569
 
471
570
  Default value is `true` which enables the [PKCE OAuth Flow](#pkce-oauth-20-flow). To use the [Implicit Flow](#implicit-oauth-20-flow) or [Authorization Code Flow](#authorization-code-flow-for-web-and-native-client-types), set `pkce` to `false`.
472
571
 
572
+ #### `dpop`
573
+
574
+ Default value is `false`. Set to `true` to enable `DPoP` (Demonstrating Proof-of-Possession ([RFC9449](https://datatracker.ietf.org/doc/html/rfc9449)))
575
+
576
+ See Guide: [Enabling DPoP](#enabling-dpop)
577
+
578
+
473
579
  #### responseMode
474
580
 
475
581
  When requesting tokens using [token.getWithRedirect](#tokengetwithredirectoptions) values will be returned as parameters appended to the [redirectUri](#configuration-options).
@@ -915,6 +1021,9 @@ The amount of time, in seconds, a tab needs to be inactive for the `RenewOnTabAc
915
1021
  * [tx.resume](#txresume)
916
1022
  * [tx.exists](#txexists)
917
1023
  * [transaction.status](#transactionstatus)
1024
+ * [getDPoPAuthorizationHeaders](#getdpopauthorizationheaders)
1025
+ * [parseUseDPoPNonceError](#parseusedpopnonceerror)
1026
+ * [clearDPoPStorage](#cleardpopstorage)
918
1027
  * [session](#session)
919
1028
  * [session.setCookieAndRedirect](#sessionsetcookieandredirectsessiontoken-redirecturi)
920
1029
  * [session.exists](#sessionexists)
@@ -1270,6 +1379,39 @@ See [authn API](docs/authn.md#txexists).
1270
1379
 
1271
1380
  See [authn API](docs/authn.md#transactionstatus).
1272
1381
 
1382
+ ### `getDPoPAuthorizationHeaders(params)`
1383
+
1384
+ > :link: web browser only <br>
1385
+ > :hourglass: async <br>
1386
+
1387
+ Requires [dpop](#dpop) set to `true`. Returns `Authorization` and `Dpop` header values to build a DPoP protected-request.
1388
+
1389
+ Params: `url` and (http) `method` are required.
1390
+ * `accessToken` is optional, but will be read from `tokenStorage` if not provided
1391
+ * `nonce` is optional, may be provided via `use_dpop_nonce` pattern from Resource Server ([more info](#handling-use_dpop_nonce))
1392
+
1393
+ ### `parseUseDPoPNonceError(headers)`
1394
+
1395
+ > :link: web browser only <br>
1396
+
1397
+ Utility to extract and parse the `WWW-Authenticate` and `DPoP-Nonce` headers from a network response from a DPoP-protected request. Should the response be in the following format, the `nonce` value will be returned. Otherwise returns `null`
1398
+
1399
+ ```
1400
+ HTTP/1.1 401 Unauthorized
1401
+ WWW-Authenticate: DPoP error="use_dpop_nonce", \
1402
+ error_description="Resource server requires nonce in DPoP proof"
1403
+ DPoP-Nonce: eyJ7S_zG.eyJH0-Z.HX4w-7v
1404
+ ```
1405
+
1406
+ ### `clearDPoPStorage(clearAll=false)`
1407
+
1408
+ > :link: web browser only <br>
1409
+ > :hourglass: async <br>
1410
+
1411
+ Clears storage location of `CryptoKeyPair`s generated and used by DPoP. Pass `true` to remove all key pairs as it's possible for orphaned key pairs to exist. If `clearAll` is `false`, the key pair bound to the current `accessToken` in tokenStorage will be removed.
1412
+
1413
+ It's recommended to call this function during user login. [See Example](#clear-dpop-storage-recommended)
1414
+
1273
1415
  ### `session`
1274
1416
 
1275
1417
  #### `session.setCookieAndRedirect(sessionToken, redirectUri)`
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../lib/base/types.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as constants from '../constants';\n\nexport declare class EventEmitter {\n on (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n once (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n emit (event: string, ...args: any[]): EventEmitter;\n off (event: string, callback?: (...args: any[]) => any): EventEmitter;\n}\n\nexport interface FeaturesAPI {\n isLocalhost(): boolean;\n isHTTPS(): boolean;\n isPopupPostMessageSupported(): boolean;\n hasTextEncoder(): boolean;\n isTokenVerifySupported(): boolean;\n isPKCESupported(): boolean;\n isIE11OrLess(): boolean;\n}\n\n\n// options that can be passed to AuthJS\nexport interface OktaAuthBaseOptions {\n devMode?: boolean;\n}\n\n// a class that constructs options\nexport interface OktaAuthOptionsConstructor<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n new(args: any): O;\n}\n\n// a \"base\" instance of AuthJS\nexport interface OktaAuthBaseInterface<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n options: O;\n emitter: EventEmitter;\n features: FeaturesAPI;\n}\n\n// a constructor that returns an instance of AuthJS\nexport interface OktaAuthConstructor\n<\n I extends OktaAuthBaseInterface = OktaAuthBaseInterface\n> \n{\n new(...args: any[]): I;\n features: FeaturesAPI; // static class member\n constants: typeof constants;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../lib/base/types.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as constants from '../constants';\n\nexport declare class EventEmitter {\n on (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n once (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n emit (event: string, ...args: any[]): EventEmitter;\n off (event: string, callback?: (...args: any[]) => any): EventEmitter;\n}\n\nexport interface FeaturesAPI {\n isLocalhost(): boolean;\n isHTTPS(): boolean;\n isPopupPostMessageSupported(): boolean;\n hasTextEncoder(): boolean;\n isTokenVerifySupported(): boolean;\n isPKCESupported(): boolean;\n isIE11OrLess(): boolean;\n isDPoPSupported(): boolean;\n}\n\n\n// options that can be passed to AuthJS\nexport interface OktaAuthBaseOptions {\n devMode?: boolean;\n}\n\n// a class that constructs options\nexport interface OktaAuthOptionsConstructor<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n new(args: any): O;\n}\n\n// a \"base\" instance of AuthJS\nexport interface OktaAuthBaseInterface<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n options: O;\n emitter: EventEmitter;\n features: FeaturesAPI;\n}\n\n// a constructor that returns an instance of AuthJS\nexport interface OktaAuthConstructor\n<\n I extends OktaAuthBaseInterface = OktaAuthBaseInterface\n> \n{\n new(...args: any[]): I;\n features: FeaturesAPI; // static class member\n constants: typeof constants;\n}\n"],"mappings":""}
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.default = void 0;
5
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
5
6
  var _CustomError = _interopRequireDefault(require("./CustomError"));
6
7
  /* eslint-disable camelcase */
7
8
  /*!
@@ -19,8 +20,9 @@ var _CustomError = _interopRequireDefault(require("./CustomError"));
19
20
  class OAuthError extends _CustomError.default {
20
21
  // for widget / idx-js backward compatibility
21
22
 
22
- constructor(errorCode, summary) {
23
+ constructor(errorCode, summary, resp) {
23
24
  super(summary);
25
+ (0, _defineProperty2.default)(this, "resp", null);
24
26
  this.name = 'OAuthError';
25
27
  this.errorCode = errorCode;
26
28
  this.errorSummary = summary;
@@ -28,6 +30,12 @@ class OAuthError extends _CustomError.default {
28
30
  // for widget / idx-js backward compatibility
29
31
  this.error = errorCode;
30
32
  this.error_description = summary;
33
+
34
+ // an OAuth error (should) always result from a network request
35
+ // therefore include that in error for potential error handling
36
+ if (resp) {
37
+ this.resp = resp;
38
+ }
31
39
  }
32
40
  }
33
41
  exports.default = OAuthError;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthError.js","names":["OAuthError","CustomError","constructor","errorCode","summary","name","errorSummary","error","error_description"],"sources":["../../../lib/errors/OAuthError.ts"],"sourcesContent":["/* eslint-disable camelcase */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport CustomError from './CustomError';\n\nexport default class OAuthError extends CustomError {\n errorCode: string;\n errorSummary: string;\n\n // for widget / idx-js backward compatibility\n error: string;\n error_description: string;\n\n constructor(errorCode: string, summary: string) {\n super(summary);\n\n this.name = 'OAuthError';\n this.errorCode = errorCode;\n this.errorSummary = summary;\n\n // for widget / idx-js backward compatibility\n this.error = errorCode;\n this.error_description = summary;\n }\n}\n\n"],"mappings":";;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIe,MAAMA,UAAU,SAASC,oBAAW,CAAC;EAIlD;;EAIAC,WAAW,CAACC,SAAiB,EAAEC,OAAe,EAAE;IAC9C,KAAK,CAACA,OAAO,CAAC;IAEd,IAAI,CAACC,IAAI,GAAG,YAAY;IACxB,IAAI,CAACF,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACG,YAAY,GAAGF,OAAO;;IAE3B;IACA,IAAI,CAACG,KAAK,GAAGJ,SAAS;IACtB,IAAI,CAACK,iBAAiB,GAAGJ,OAAO;EAClC;AACF;AAAC;AAAA"}
1
+ {"version":3,"file":"OAuthError.js","names":["OAuthError","CustomError","constructor","errorCode","summary","resp","name","errorSummary","error","error_description"],"sources":["../../../lib/errors/OAuthError.ts"],"sourcesContent":["/* eslint-disable camelcase */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport CustomError from './CustomError';\nimport type { HttpResponse } from '../http';\n\nexport default class OAuthError extends CustomError {\n errorCode: string;\n errorSummary: string;\n\n // for widget / idx-js backward compatibility\n error: string;\n error_description: string;\n\n resp: HttpResponse | null = null;\n\n constructor(errorCode: string, summary: string, resp?: HttpResponse) {\n super(summary);\n\n this.name = 'OAuthError';\n this.errorCode = errorCode;\n this.errorSummary = summary;\n\n // for widget / idx-js backward compatibility\n this.error = errorCode;\n this.error_description = summary;\n\n // an OAuth error (should) always result from a network request\n // therefore include that in error for potential error handling\n if (resp) {\n this.resp = resp;\n }\n }\n}\n\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKe,MAAMA,UAAU,SAASC,oBAAW,CAAC;EAIlD;;EAMAC,WAAW,CAACC,SAAiB,EAAEC,OAAe,EAAEC,IAAmB,EAAE;IACnE,KAAK,CAACD,OAAO,CAAC;IAAC,4CAHW,IAAI;IAK9B,IAAI,CAACE,IAAI,GAAG,YAAY;IACxB,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACI,YAAY,GAAGH,OAAO;;IAE3B;IACA,IAAI,CAACI,KAAK,GAAGL,SAAS;IACtB,IAAI,CAACM,iBAAiB,GAAGL,OAAO;;IAEhC;IACA;IACA,IAAIC,IAAI,EAAE;MACR,IAAI,CAACA,IAAI,GAAGA,IAAI;IAClB;EACF;AACF;AAAC;AAAA"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.default = void 0;
5
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
6
+ var _CustomError = _interopRequireDefault(require("./CustomError"));
7
+ var _util = require("../util");
8
+ /*!
9
+ * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
10
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
11
+ *
12
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ *
17
+ * See the License for the specific language governing permissions and limitations under the License.
18
+ */
19
+
20
+ // Error thrown after an unsuccessful network request which requires an Authorization header
21
+ // and returns a 4XX error with a www-authenticate header. The header value is parsed to construct
22
+ // an error instance, which contains key/value pairs parsed out
23
+ class WWWAuthError extends _CustomError.default {
24
+ constructor(scheme, parameters, resp) {
25
+ // defaults to unknown error. `error` being returned in the www-authenticate header is expected
26
+ // but cannot be guaranteed. Throwing an error within a error constructor seems awkward
27
+ super(parameters.error ?? WWWAuthError.UNKNOWN_ERROR);
28
+ (0, _defineProperty2.default)(this, "name", 'WWWAuthError');
29
+ (0, _defineProperty2.default)(this, "resp", null);
30
+ this.scheme = scheme;
31
+ this.parameters = parameters;
32
+ if (resp) {
33
+ this.resp = resp;
34
+ }
35
+ }
36
+
37
+ // convenience references
38
+ get error() {
39
+ return this.parameters.error;
40
+ }
41
+ get errorCode() {
42
+ return this.error;
43
+ } // parity with other error props
44
+ // eslint-disable-next-line camelcase
45
+ get error_description() {
46
+ return this.parameters.error_description;
47
+ }
48
+ // eslint-disable-next-line camelcase
49
+ get errorDescription() {
50
+ return this.error_description;
51
+ }
52
+ get errorSummary() {
53
+ return this.errorDescription;
54
+ } // parity with other error props
55
+ get realm() {
56
+ return this.parameters.realm;
57
+ }
58
+
59
+ // parses the www-authenticate header for releveant
60
+ static parseHeader(header) {
61
+ // header cannot be empty string
62
+ if (!header) {
63
+ return null;
64
+ }
65
+
66
+ // example string: Bearer error="invalid_token", error_description="The access token is invalid"
67
+ // regex will match on `error="invalid_token", error_description="The access token is invalid"`
68
+ // see unit test for more examples of possible www-authenticate values
69
+ // eslint-disable-next-line max-len
70
+ const regex = /(?:,|, )?([a-zA-Z0-9!#$%&'*+\-.^_`|~]+)=(?:"([a-zA-Z0-9!#$%&'*+\-.,^_`|~ /:]+)"|([a-zA-Z0-9!#$%&'*+\-.^_`|~/:]+))/g;
71
+ const firstSpace = header.indexOf(' ');
72
+ const scheme = header.slice(0, firstSpace);
73
+ const remaining = header.slice(firstSpace + 1);
74
+ const params = {};
75
+
76
+ // Reference: foo="hello", bar="bye"
77
+ // i=0, match=[foo="hello1", foo, hello]
78
+ // i=1, match=[bar="bye", bar, bye]
79
+ let match;
80
+ while ((match = regex.exec(remaining)) !== null) {
81
+ params[match[1]] = match[2] ?? match[3];
82
+ }
83
+ return new WWWAuthError(scheme, params);
84
+ }
85
+
86
+ // finds the value of the `www-authenticate` header. HeadersInit allows for a few different
87
+ // representations of headers with different access patterns (.get vs [key])
88
+ static getWWWAuthenticateHeader(headers = {}) {
89
+ if ((0, _util.isFunction)(headers?.get)) {
90
+ return headers.get('WWW-Authenticate');
91
+ }
92
+ return headers['www-authenticate'] ?? headers['WWW-Authenticate'];
93
+ }
94
+ }
95
+ exports.default = WWWAuthError;
96
+ (0, _defineProperty2.default)(WWWAuthError, "UNKNOWN_ERROR", 'UNKNOWN_WWW_AUTH_ERROR');
97
+ module.exports = exports.default;
98
+ //# sourceMappingURL=WWWAuthError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WWWAuthError.js","names":["WWWAuthError","CustomError","constructor","scheme","parameters","resp","error","UNKNOWN_ERROR","errorCode","error_description","errorDescription","errorSummary","realm","parseHeader","header","regex","firstSpace","indexOf","slice","remaining","params","match","exec","getWWWAuthenticateHeader","headers","isFunction","get"],"sources":["../../../lib/errors/WWWAuthError.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport type { HttpResponse } from '../http';\nimport CustomError from './CustomError';\nimport { isFunction } from '../util';\n\n// Error thrown after an unsuccessful network request which requires an Authorization header \n// and returns a 4XX error with a www-authenticate header. The header value is parsed to construct \n// an error instance, which contains key/value pairs parsed out\nexport default class WWWAuthError extends CustomError {\n static UNKNOWN_ERROR = 'UNKNOWN_WWW_AUTH_ERROR';\n\n scheme: string;\n parameters: Record<string, string>;\n name = 'WWWAuthError';\n\n resp: HttpResponse | null = null;\n\n constructor(scheme: string, parameters: Record<string, string>, resp?: HttpResponse) {\n // defaults to unknown error. `error` being returned in the www-authenticate header is expected\n // but cannot be guaranteed. Throwing an error within a error constructor seems awkward\n super(parameters.error ?? WWWAuthError.UNKNOWN_ERROR);\n this.scheme = scheme;\n this.parameters = parameters;\n\n if (resp) {\n this.resp = resp;\n }\n }\n\n // convenience references\n get error (): string { return this.parameters.error; }\n get errorCode (): string { return this.error; } // parity with other error props\n // eslint-disable-next-line camelcase\n get error_description (): string { return this.parameters.error_description; }\n // eslint-disable-next-line camelcase\n get errorDescription (): string { return this.error_description; }\n get errorSummary (): string { return this.errorDescription; } // parity with other error props\n get realm (): string { return this.parameters.realm; }\n\n // parses the www-authenticate header for releveant\n static parseHeader (header: string): WWWAuthError | null {\n // header cannot be empty string\n if (!header) {\n return null;\n }\n\n // example string: Bearer error=\"invalid_token\", error_description=\"The access token is invalid\"\n // regex will match on `error=\"invalid_token\", error_description=\"The access token is invalid\"`\n // see unit test for more examples of possible www-authenticate values\n // eslint-disable-next-line max-len\n const regex = /(?:,|, )?([a-zA-Z0-9!#$%&'*+\\-.^_`|~]+)=(?:\"([a-zA-Z0-9!#$%&'*+\\-.,^_`|~ /:]+)\"|([a-zA-Z0-9!#$%&'*+\\-.^_`|~/:]+))/g;\n const firstSpace = header.indexOf(' ');\n const scheme = header.slice(0, firstSpace);\n const remaining = header.slice(firstSpace + 1);\n const params = {};\n\n // Reference: foo=\"hello\", bar=\"bye\"\n // i=0, match=[foo=\"hello1\", foo, hello]\n // i=1, match=[bar=\"bye\", bar, bye]\n let match;\n while ((match = regex.exec(remaining)) !== null) {\n params[match[1]] = (match[2] ?? match[3]);\n }\n\n return new WWWAuthError(scheme, params);\n }\n\n // finds the value of the `www-authenticate` header. HeadersInit allows for a few different\n // representations of headers with different access patterns (.get vs [key])\n static getWWWAuthenticateHeader (headers: HeadersInit = {}): string | null {\n if (isFunction((headers as Headers)?.get)) {\n return (headers as Headers).get('WWW-Authenticate');\n }\n return headers['www-authenticate'] ?? headers['WWW-Authenticate'];\n }\n}\n"],"mappings":";;;;;AAcA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACe,MAAMA,YAAY,SAASC,oBAAW,CAAC;EASpDC,WAAW,CAACC,MAAc,EAAEC,UAAkC,EAAEC,IAAmB,EAAE;IACnF;IACA;IACA,KAAK,CAACD,UAAU,CAACE,KAAK,IAAIN,YAAY,CAACO,aAAa,CAAC;IAAC,4CAPjD,cAAc;IAAA,4CAEO,IAAI;IAM9B,IAAI,CAACJ,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAE5B,IAAIC,IAAI,EAAE;MACR,IAAI,CAACA,IAAI,GAAGA,IAAI;IAClB;EACF;;EAEA;EACA,IAAIC,KAAK,GAAY;IAAE,OAAO,IAAI,CAACF,UAAU,CAACE,KAAK;EAAE;EACrD,IAAIE,SAAS,GAAY;IAAE,OAAO,IAAI,CAACF,KAAK;EAAE,CAAC,CAAiB;EAChE;EACA,IAAIG,iBAAiB,GAAY;IAAE,OAAO,IAAI,CAACL,UAAU,CAACK,iBAAiB;EAAE;EAC7E;EACA,IAAIC,gBAAgB,GAAY;IAAE,OAAO,IAAI,CAACD,iBAAiB;EAAE;EACjE,IAAIE,YAAY,GAAY;IAAE,OAAO,IAAI,CAACD,gBAAgB;EAAE,CAAC,CAAG;EAChE,IAAIE,KAAK,GAAY;IAAE,OAAO,IAAI,CAACR,UAAU,CAACQ,KAAK;EAAE;;EAErD;EACA,OAAOC,WAAW,CAAEC,MAAc,EAAuB;IACvD;IACA,IAAI,CAACA,MAAM,EAAE;MACX,OAAO,IAAI;IACb;;IAEA;IACA;IACA;IACA;IACA,MAAMC,KAAK,GAAG,oHAAoH;IAClI,MAAMC,UAAU,GAAGF,MAAM,CAACG,OAAO,CAAC,GAAG,CAAC;IACtC,MAAMd,MAAM,GAAGW,MAAM,CAACI,KAAK,CAAC,CAAC,EAAEF,UAAU,CAAC;IAC1C,MAAMG,SAAS,GAAGL,MAAM,CAACI,KAAK,CAACF,UAAU,GAAG,CAAC,CAAC;IAC9C,MAAMI,MAAM,GAAG,CAAC,CAAC;;IAEjB;IACA;IACA;IACA,IAAIC,KAAK;IACT,OAAO,CAACA,KAAK,GAAGN,KAAK,CAACO,IAAI,CAACH,SAAS,CAAC,MAAM,IAAI,EAAE;MAC/CC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAIA,KAAK,CAAC,CAAC,CAAC,IAAIA,KAAK,CAAC,CAAC,CAAE;IAC3C;IAEA,OAAO,IAAIrB,YAAY,CAACG,MAAM,EAAEiB,MAAM,CAAC;EACzC;;EAEA;EACA;EACA,OAAOG,wBAAwB,CAAEC,OAAoB,GAAG,CAAC,CAAC,EAAiB;IACzE,IAAI,IAAAC,gBAAU,EAAED,OAAO,EAAcE,GAAG,CAAC,EAAE;MACzC,OAAQF,OAAO,CAAaE,GAAG,CAAC,kBAAkB,CAAC;IACrD;IACA,OAAOF,OAAO,CAAC,kBAAkB,CAAC,IAAIA,OAAO,CAAC,kBAAkB,CAAC;EACnE;AACF;AAAC;AAAA,8BAnEoBxB,YAAY,mBACR,wBAAwB;AAAA"}
@@ -4,10 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _exportNames = {
5
5
  isAuthApiError: true,
6
6
  isOAuthError: true,
7
+ isWWWAuthError: true,
7
8
  AuthApiError: true,
8
9
  AuthPollStopError: true,
9
10
  AuthSdkError: true,
10
- OAuthError: true
11
+ OAuthError: true,
12
+ WWWAuthError: true
11
13
  };
12
14
  Object.defineProperty(exports, "AuthApiError", {
13
15
  enumerable: true,
@@ -33,12 +35,20 @@ Object.defineProperty(exports, "OAuthError", {
33
35
  return _OAuthError.default;
34
36
  }
35
37
  });
38
+ Object.defineProperty(exports, "WWWAuthError", {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _WWWAuthError.default;
42
+ }
43
+ });
36
44
  exports.isAuthApiError = isAuthApiError;
37
45
  exports.isOAuthError = isOAuthError;
46
+ exports.isWWWAuthError = isWWWAuthError;
38
47
  var _AuthApiError = _interopRequireDefault(require("./AuthApiError"));
39
48
  var _AuthPollStopError = _interopRequireDefault(require("./AuthPollStopError"));
40
49
  var _AuthSdkError = _interopRequireDefault(require("./AuthSdkError"));
41
50
  var _OAuthError = _interopRequireDefault(require("./OAuthError"));
51
+ var _WWWAuthError = _interopRequireDefault(require("./WWWAuthError"));
42
52
  var _types = require("./types");
43
53
  Object.keys(_types).forEach(function (key) {
44
54
  if (key === "default" || key === "__esModule") return;
@@ -69,4 +79,7 @@ function isAuthApiError(obj) {
69
79
  function isOAuthError(obj) {
70
80
  return obj instanceof _OAuthError.default;
71
81
  }
82
+ function isWWWAuthError(obj) {
83
+ return obj instanceof _WWWAuthError.default;
84
+ }
72
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isAuthApiError","obj","AuthApiError","isOAuthError","OAuthError"],"sources":["../../../lib/errors/index.ts"],"sourcesContent":["\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport AuthApiError from './AuthApiError';\nimport AuthPollStopError from './AuthPollStopError';\nimport AuthSdkError from './AuthSdkError';\nimport OAuthError from './OAuthError';\n\nfunction isAuthApiError(obj: any): obj is AuthApiError {\n return (obj instanceof AuthApiError);\n}\n\nfunction isOAuthError(obj: any): obj is OAuthError {\n return (obj instanceof OAuthError);\n}\n\nexport {\n isAuthApiError,\n isOAuthError,\n AuthApiError,\n AuthPollStopError,\n AuthSdkError,\n OAuthError\n};\n\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA;AACA;AACA;AAmBA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAlCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,cAAc,CAACC,GAAQ,EAAuB;EACrD,OAAQA,GAAG,YAAYC,qBAAY;AACrC;AAEA,SAASC,YAAY,CAACF,GAAQ,EAAqB;EACjD,OAAQA,GAAG,YAAYG,mBAAU;AACnC"}
1
+ {"version":3,"file":"index.js","names":["isAuthApiError","obj","AuthApiError","isOAuthError","OAuthError","isWWWAuthError","WWWAuthError"],"sources":["../../../lib/errors/index.ts"],"sourcesContent":["\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport AuthApiError from './AuthApiError';\nimport AuthPollStopError from './AuthPollStopError';\nimport AuthSdkError from './AuthSdkError';\nimport OAuthError from './OAuthError';\nimport WWWAuthError from './WWWAuthError';\n\nfunction isAuthApiError(obj: any): obj is AuthApiError {\n return (obj instanceof AuthApiError);\n}\n\nfunction isOAuthError(obj: any): obj is OAuthError {\n return (obj instanceof OAuthError);\n}\n\nfunction isWWWAuthError(obj: any): obj is WWWAuthError {\n return (obj instanceof WWWAuthError);\n}\n\nexport {\n isAuthApiError,\n isOAuthError,\n isWWWAuthError,\n AuthApiError,\n AuthPollStopError,\n AuthSdkError,\n OAuthError,\n WWWAuthError\n};\n\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA;AACA;AACA;AACA;AAyBA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,cAAc,CAACC,GAAQ,EAAuB;EACrD,OAAQA,GAAG,YAAYC,qBAAY;AACrC;AAEA,SAASC,YAAY,CAACF,GAAQ,EAAqB;EACjD,OAAQA,GAAG,YAAYG,mBAAU;AACnC;AAEA,SAASC,cAAc,CAACJ,GAAQ,EAAuB;EACrD,OAAQA,GAAG,YAAYK,qBAAY;AACrC"}
package/cjs/features.js CHANGED
@@ -3,6 +3,7 @@
3
3
  exports.getUserAgent = getUserAgent;
4
4
  exports.hasTextEncoder = hasTextEncoder;
5
5
  exports.isBrowser = isBrowser;
6
+ exports.isDPoPSupported = isDPoPSupported;
6
7
  exports.isFingerprintSupported = isFingerprintSupported;
7
8
  exports.isHTTPS = isHTTPS;
8
9
  exports.isIE11OrLess = isIE11OrLess;
@@ -55,9 +56,12 @@ function isPopupPostMessageSupported() {
55
56
  }
56
57
  return false;
57
58
  }
58
- function isTokenVerifySupported() {
59
+ function isWebCryptoSubtleSupported() {
59
60
  return typeof _crypto.webcrypto !== 'undefined' && _crypto.webcrypto !== null && typeof _crypto.webcrypto.subtle !== 'undefined' && typeof Uint8Array !== 'undefined';
60
61
  }
62
+ function isTokenVerifySupported() {
63
+ return isWebCryptoSubtleSupported();
64
+ }
61
65
  function hasTextEncoder() {
62
66
  return typeof TextEncoder !== 'undefined';
63
67
  }
@@ -74,4 +78,9 @@ function isLocalhost() {
74
78
  // eslint-disable-next-line compat/compat
75
79
  return isBrowser() && window.location.hostname === 'localhost';
76
80
  }
81
+
82
+ // For now, DPoP is only supported on browsers
83
+ function isDPoPSupported() {
84
+ return !isIE11OrLess() && typeof window.indexedDB !== 'undefined' && hasTextEncoder() && isWebCryptoSubtleSupported();
85
+ }
77
86
  //# sourceMappingURL=features.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features.js","names":["isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","isTokenVerifySupported","webcrypto","subtle","Uint8Array","hasTextEncoder","TextEncoder","isPKCESupported","isHTTPS","location","protocol","isLocalhost","hostname"],"sources":["../../lib/features.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* eslint-disable node/no-unsupported-features/node-builtins */\n/* global document, window, TextEncoder, navigator */\n\nimport { webcrypto } from './crypto';\n\nconst isWindowsPhone = /windows phone|iemobile|wpdesktop/i;\t\n\nexport function isBrowser() {\n return typeof document !== 'undefined' && typeof window !== 'undefined';\n}\n\nexport function isIE11OrLess() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n return !!documentMode && documentMode <= 11;\n}\n\nexport function getUserAgent() {\n return navigator.userAgent;\n}\n\nexport function isFingerprintSupported() {\n const agent = getUserAgent();\n return agent && !isWindowsPhone.test(agent);\t\n}\n\nexport function isPopupPostMessageSupported() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n var isIE8or9 = documentMode && documentMode < 10;\n if (typeof window.postMessage !== 'undefined' && !isIE8or9) {\n return true;\n }\n return false;\n}\n\nexport function isTokenVerifySupported() {\n return typeof webcrypto !== 'undefined'\n && webcrypto !== null\n && typeof webcrypto.subtle !== 'undefined'\n && typeof Uint8Array !== 'undefined';\n}\n\nexport function hasTextEncoder() {\n return typeof TextEncoder !== 'undefined';\n}\n\nexport function isPKCESupported() {\n return isTokenVerifySupported() && hasTextEncoder();\n}\n\nexport function isHTTPS() {\n if (!isBrowser()) {\n return false;\n }\n return window.location.protocol === 'https:';\n}\n\nexport function isLocalhost() {\n // eslint-disable-next-line compat/compat\n return isBrowser() && window.location.hostname === 'localhost';\n}\n\n"],"mappings":";;;;;;;;;;;;AAeA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAIA,MAAMA,cAAc,GAAG,mCAAmC;AAEnD,SAASC,SAAS,GAAG;EAC1B,OAAO,OAAOC,QAAQ,KAAK,WAAW,IAAI,OAAOC,MAAM,KAAK,WAAW;AACzE;AAEO,SAASC,YAAY,GAAG;EAC7B,IAAI,CAACH,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,MAAMI,YAAY,GAAIH,QAAQ,CAASG,YAAY;EACnD,OAAO,CAAC,CAACA,YAAY,IAAIA,YAAY,IAAI,EAAE;AAC7C;AAEO,SAASC,YAAY,GAAG;EAC7B,OAAOC,SAAS,CAACC,SAAS;AAC5B;AAEO,SAASC,sBAAsB,GAAG;EACvC,MAAMC,KAAK,GAAGJ,YAAY,EAAE;EAC5B,OAAOI,KAAK,IAAI,CAACV,cAAc,CAACW,IAAI,CAACD,KAAK,CAAC;AAC7C;AAEO,SAASE,2BAA2B,GAAG;EAC5C,IAAI,CAACX,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,MAAMI,YAAY,GAAIH,QAAQ,CAASG,YAAY;EACnD,IAAIQ,QAAQ,GAAGR,YAAY,IAAIA,YAAY,GAAG,EAAE;EAChD,IAAI,OAAOF,MAAM,CAACW,WAAW,KAAK,WAAW,IAAI,CAACD,QAAQ,EAAE;IAC1D,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;AAEO,SAASE,sBAAsB,GAAG;EACvC,OAAO,OAAOC,iBAAS,KAAK,WAAW,IAClCA,iBAAS,KAAK,IAAI,IAClB,OAAOA,iBAAS,CAACC,MAAM,KAAK,WAAW,IACvC,OAAOC,UAAU,KAAK,WAAW;AACxC;AAEO,SAASC,cAAc,GAAG;EAC/B,OAAO,OAAOC,WAAW,KAAK,WAAW;AAC3C;AAEO,SAASC,eAAe,GAAG;EAChC,OAAON,sBAAsB,EAAE,IAAII,cAAc,EAAE;AACrD;AAEO,SAASG,OAAO,GAAG;EACxB,IAAI,CAACrB,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,OAAOE,MAAM,CAACoB,QAAQ,CAACC,QAAQ,KAAK,QAAQ;AAC9C;AAEO,SAASC,WAAW,GAAG;EAC5B;EACA,OAAOxB,SAAS,EAAE,IAAIE,MAAM,CAACoB,QAAQ,CAACG,QAAQ,KAAK,WAAW;AAChE"}
1
+ {"version":3,"file":"features.js","names":["isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","isWebCryptoSubtleSupported","webcrypto","subtle","Uint8Array","isTokenVerifySupported","hasTextEncoder","TextEncoder","isPKCESupported","isHTTPS","location","protocol","isLocalhost","hostname","isDPoPSupported","indexedDB"],"sources":["../../lib/features.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* eslint-disable node/no-unsupported-features/node-builtins */\n/* global document, window, TextEncoder, navigator */\n\nimport { webcrypto } from './crypto';\n\nconst isWindowsPhone = /windows phone|iemobile|wpdesktop/i;\t\n\nexport function isBrowser() {\n return typeof document !== 'undefined' && typeof window !== 'undefined';\n}\n\nexport function isIE11OrLess() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n return !!documentMode && documentMode <= 11;\n}\n\nexport function getUserAgent() {\n return navigator.userAgent;\n}\n\nexport function isFingerprintSupported() {\n const agent = getUserAgent();\n return agent && !isWindowsPhone.test(agent);\t\n}\n\nexport function isPopupPostMessageSupported() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n var isIE8or9 = documentMode && documentMode < 10;\n if (typeof window.postMessage !== 'undefined' && !isIE8or9) {\n return true;\n }\n return false;\n}\n\nfunction isWebCryptoSubtleSupported () {\n return typeof webcrypto !== 'undefined'\n && webcrypto !== null\n && typeof webcrypto.subtle !== 'undefined'\n && typeof Uint8Array !== 'undefined';\n}\n\nexport function isTokenVerifySupported() {\n return isWebCryptoSubtleSupported();\n}\n\nexport function hasTextEncoder() {\n return typeof TextEncoder !== 'undefined';\n}\n\nexport function isPKCESupported() {\n return isTokenVerifySupported() && hasTextEncoder();\n}\n\nexport function isHTTPS() {\n if (!isBrowser()) {\n return false;\n }\n return window.location.protocol === 'https:';\n}\n\nexport function isLocalhost() {\n // eslint-disable-next-line compat/compat\n return isBrowser() && window.location.hostname === 'localhost';\n}\n\n// For now, DPoP is only supported on browsers\nexport function isDPoPSupported () {\n return !isIE11OrLess() &&\n typeof window.indexedDB !== 'undefined' &&\n hasTextEncoder() &&\n isWebCryptoSubtleSupported();\n}\n"],"mappings":";;;;;;;;;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,SAASC,eAAe,GAAG;EAChC,OAAOH,sBAAsB,EAAE,IAAIC,cAAc,EAAE;AACrD;AAEO,SAASG,OAAO,GAAG;EACxB,IAAI,CAACtB,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,OAAOE,MAAM,CAACqB,QAAQ,CAACC,QAAQ,KAAK,QAAQ;AAC9C;AAEO,SAASC,WAAW,GAAG;EAC5B;EACA,OAAOzB,SAAS,EAAE,IAAIE,MAAM,CAACqB,QAAQ,CAACG,QAAQ,KAAK,WAAW;AAChE;;AAEA;AACO,SAASC,eAAe,GAAI;EACjC,OAAO,CAACxB,YAAY,EAAE,IACpB,OAAOD,MAAM,CAAC0B,SAAS,KAAK,WAAW,IACvCT,cAAc,EAAE,IAChBL,0BAA0B,EAAE;AAChC"}
@@ -20,7 +20,7 @@ var _features = require("../features");
20
20
  class OktaUserAgent {
21
21
  constructor() {
22
22
  // add base sdk env
23
- this.environments = [`okta-auth-js/${"7.6.0"}`];
23
+ this.environments = [`okta-auth-js/${"7.7.0"}`];
24
24
  this.maybeAddNodeEnvironment();
25
25
  }
26
26
  addEnvironment(env) {
@@ -32,7 +32,7 @@ class OktaUserAgent {
32
32
  };
33
33
  }
34
34
  getVersion() {
35
- return "7.6.0";
35
+ return "7.7.0";
36
36
  }
37
37
  maybeAddNodeEnvironment() {
38
38
  if ((0, _features.isBrowser)() || !process || !process.versions) {
@@ -22,16 +22,6 @@ var _errors = require("../errors");
22
22
 
23
23
  /* eslint-disable complexity */
24
24
 
25
- const parseInsufficientAuthenticationError = header => {
26
- if (!header) {
27
- throw new _errors.AuthSdkError('Missing header string');
28
- }
29
- return header.split(',').map(part => part.trim()).map(part => part.split('=')).reduce((acc, curr) => {
30
- // unwrap quotes from value
31
- acc[curr[0]] = curr[1].replace(/^"(.*)"$/, '$1');
32
- return acc;
33
- }, {});
34
- };
35
25
  const formatError = (sdk, error) => {
36
26
  if (error instanceof Error) {
37
27
  // fetch() can throw exceptions
@@ -58,27 +48,29 @@ const formatError = (sdk, error) => {
58
48
  if (sdk.options.transformErrorXHR) {
59
49
  resp = sdk.options.transformErrorXHR((0, _util.clone)(resp));
60
50
  }
51
+
52
+ //
53
+ const wwwAuthHeader = _errors.WWWAuthError.getWWWAuthenticateHeader(resp?.headers) ?? '';
61
54
  if (serverErr.error && serverErr.error_description) {
62
- err = new _errors.OAuthError(serverErr.error, serverErr.error_description);
55
+ err = new _errors.OAuthError(serverErr.error, serverErr.error_description, resp);
63
56
  } else {
64
- err = new _errors.AuthApiError(serverErr, resp);
57
+ err = new _errors.AuthApiError(serverErr, resp, {
58
+ wwwAuthHeader
59
+ });
65
60
  }
66
- if (resp?.status === 403 && !!resp?.headers?.['www-authenticate']) {
67
- const {
68
- error,
61
+ if (wwwAuthHeader && resp?.status >= 400 && resp?.status < 500) {
62
+ const wwwAuthErr = _errors.WWWAuthError.parseHeader(wwwAuthHeader);
63
+ // check for 403 to avoid breaking change
64
+ if (resp.status === 403 && wwwAuthErr?.error === 'insufficient_authentication_context') {
69
65
  // eslint-disable-next-line camelcase
70
- error_description,
71
- // eslint-disable-next-line camelcase
72
- max_age,
73
- // eslint-disable-next-line camelcase
74
- acr_values
75
- } = parseInsufficientAuthenticationError(resp?.headers?.['www-authenticate']);
76
- if (error === 'insufficient_authentication_context') {
66
+ const {
67
+ max_age,
68
+ acr_values
69
+ } = wwwAuthErr.parameters;
77
70
  err = new _errors.AuthApiError({
78
- errorSummary: error,
79
- // eslint-disable-next-line camelcase
71
+ errorSummary: wwwAuthErr.error,
80
72
  errorCauses: [{
81
- errorSummary: error_description
73
+ errorSummary: wwwAuthErr.errorDescription
82
74
  }]
83
75
  }, resp, {
84
76
  // eslint-disable-next-line camelcase
@@ -88,8 +80,15 @@ const formatError = (sdk, error) => {
88
80
  acr_values
89
81
  })
90
82
  });
83
+ } else if (wwwAuthErr?.scheme === 'DPoP') {
84
+ err = wwwAuthErr;
91
85
  }
86
+ // else {
87
+ // // WWWAuthError.parseHeader may return null, only overwrite if !null
88
+ // err = wwwAuthErr ?? err;
89
+ // }
92
90
  }
91
+
93
92
  return err;
94
93
  };
95
94
  function httpRequest(sdk, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","names":["parseInsufficientAuthenticationError","header","AuthSdkError","split","map","part","trim","reduce","acc","curr","replace","formatError","sdk","error","Error","AuthApiError","errorSummary","message","resp","err","serverErr","responseText","isString","JSON","parse","e","status","options","transformErrorXHR","clone","error_description","OAuthError","headers","max_age","acr_values","errorCauses","httpRequest","httpRequestInterceptors","interceptor","url","method","args","saveAuthnState","accessToken","withCredentials","storageUtil","storage","httpCache","storageManager","getHttpCache","cookies","cacheResponse","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","Promise","resolve","response","oktaUserAgentHeader","_oktaUserAgent","getHttpHeader","Object","assign","removeNils","ajaxOptions","data","undefined","res","httpRequestClient","then","Array","isArray","forEach","item","stateToken","delete","STATE_TOKEN_KEY_NAME","set","updateStorage","Math","floor","DEFAULT_CACHE_DURATION","catch","errorCode","get","isAbsoluteUrl","getIssuerOrigin","getOptions","post","postOptions"],"sources":["../../../lib/http/request.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\n/* eslint-disable complexity */\nimport { isString, clone, isAbsoluteUrl, removeNils } from '../util';\nimport { STATE_TOKEN_KEY_NAME, DEFAULT_CACHE_DURATION } from '../constants';\nimport {\n OktaAuthHttpInterface,\n RequestOptions,\n FetchOptions,\n RequestData,\n HttpResponse\n} from './types';\nimport { AuthApiError, OAuthError, AuthSdkError, APIError } from '../errors';\n\ntype InsufficientAuthenticationError = {\n error: string;\n // eslint-disable-next-line camelcase\n error_description: string;\n // eslint-disable-next-line camelcase\n max_age: string;\n // eslint-disable-next-line camelcase\n acr_values: string;\n};\n\nconst parseInsufficientAuthenticationError = (\n header: string\n): InsufficientAuthenticationError => {\n if (!header) {\n throw new AuthSdkError('Missing header string');\n }\n\n return header\n .split(',')\n .map(part => part.trim())\n .map(part => part.split('='))\n .reduce((acc, curr) => {\n // unwrap quotes from value\n acc[curr[0]] = curr[1].replace(/^\"(.*)\"$/, '$1');\n return acc;\n }, {}) as InsufficientAuthenticationError;\n};\n\nconst formatError = (sdk: OktaAuthHttpInterface, error: HttpResponse | Error): AuthApiError | OAuthError => {\n if (error instanceof Error) {\n // fetch() can throw exceptions\n // see https://developer.mozilla.org/en-US/docs/Web/API/fetch#exceptions\n return new AuthApiError({\n errorSummary: error.message,\n });\n }\n\n let resp: HttpResponse = error;\n let err: AuthApiError | OAuthError;\n let serverErr: Record<string, any> = {};\n if (resp.responseText && isString(resp.responseText)) {\n try {\n serverErr = JSON.parse(resp.responseText);\n } catch (e) {\n serverErr = {\n errorSummary: 'Unknown error'\n };\n }\n }\n\n if (resp.status >= 500) {\n serverErr.errorSummary = 'Unknown error';\n }\n\n if (sdk.options.transformErrorXHR) {\n resp = sdk.options.transformErrorXHR(clone(resp));\n }\n\n if (serverErr.error && serverErr.error_description) {\n err = new OAuthError(serverErr.error, serverErr.error_description);\n } else {\n err = new AuthApiError(serverErr as APIError, resp);\n }\n\n if (resp?.status === 403 && !!resp?.headers?.['www-authenticate']) {\n const { \n error, \n // eslint-disable-next-line camelcase\n error_description,\n // eslint-disable-next-line camelcase\n max_age,\n // eslint-disable-next-line camelcase\n acr_values \n } = parseInsufficientAuthenticationError(resp?.headers?.['www-authenticate']);\n if (error === 'insufficient_authentication_context') {\n err = new AuthApiError(\n { \n errorSummary: error,\n // eslint-disable-next-line camelcase\n errorCauses: [{ errorSummary: error_description }]\n }, \n resp, \n {\n // eslint-disable-next-line camelcase\n max_age: +max_age,\n // eslint-disable-next-line camelcase\n ...(acr_values && { acr_values })\n }\n );\n }\n }\n\n return err;\n};\n\nexport function httpRequest(sdk: OktaAuthHttpInterface, options: RequestOptions): Promise<any> {\n options = options || {};\n\n if (sdk.options.httpRequestInterceptors) {\n for (const interceptor of sdk.options.httpRequestInterceptors) {\n interceptor(options);\n }\n }\n\n var url = options.url,\n method = options.method,\n args = options.args,\n saveAuthnState = options.saveAuthnState,\n accessToken = options.accessToken,\n withCredentials = options.withCredentials === true, // default value is false\n storageUtil = sdk.options.storageUtil,\n storage = storageUtil!.storage,\n httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n if (options.cacheResponse) {\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[url as string];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n return Promise.resolve(cachedResponse.response);\n }\n }\n\n var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();\n var headers: HeadersInit = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n ...oktaUserAgentHeader\n };\n Object.assign(headers, sdk.options.headers, options.headers);\n headers = removeNils(headers) as HeadersInit;\n\n if (accessToken && isString(accessToken)) {\n headers['Authorization'] = 'Bearer ' + accessToken;\n }\n\n var ajaxOptions: FetchOptions = {\n headers,\n data: args || undefined,\n withCredentials\n };\n\n var err, res;\n return sdk.options.httpRequestClient!(method!, url!, ajaxOptions)\n .then(function(resp) {\n res = resp.responseText;\n if (res && isString(res)) {\n res = JSON.parse(res);\n if (res && typeof res === 'object' && !res.headers) {\n if (Array.isArray(res)) {\n res.forEach(item => {\n item.headers = resp.headers;\n });\n } else {\n res.headers = resp.headers;\n }\n }\n }\n\n if (saveAuthnState) {\n if (!res.stateToken) {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n }\n\n if (res && res.stateToken && res.expiresAt) {\n storage.set(STATE_TOKEN_KEY_NAME, res.stateToken, res.expiresAt, sdk.options.cookies!);\n }\n\n if (res && options.cacheResponse) {\n httpCache.updateStorage(url!, {\n expiresAt: Math.floor(Date.now()/1000) + DEFAULT_CACHE_DURATION,\n response: res\n });\n }\n \n return res;\n })\n .catch(function(resp) {\n err = formatError(sdk, resp);\n\n if (err.errorCode === 'E0000011') {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n\n throw err;\n });\n}\n\nexport function get(sdk: OktaAuthHttpInterface, url: string, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var getOptions = {\n url: url,\n method: 'GET'\n };\n Object.assign(getOptions, options);\n return httpRequest(sdk, getOptions);\n}\n\nexport function post(sdk: OktaAuthHttpInterface, url: string, args?: RequestData, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var postOptions = {\n url: url,\n method: 'POST',\n args: args,\n saveAuthnState: true\n };\n Object.assign(postOptions, options);\n return httpRequest(sdk, postOptions);\n}\n"],"mappings":";;;;;AAeA;AACA;AAQA;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAsBA,MAAMA,oCAAoC,GACxCC,MAAc,IACsB;EACpC,IAAI,CAACA,MAAM,EAAE;IACX,MAAM,IAAIC,oBAAY,CAAC,uBAAuB,CAAC;EACjD;EAEA,OAAOD,MAAM,CACVE,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAACC,IAAI,IAAIA,IAAI,CAACC,IAAI,EAAE,CAAC,CACxBF,GAAG,CAACC,IAAI,IAAIA,IAAI,CAACF,KAAK,CAAC,GAAG,CAAC,CAAC,CAC5BI,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAK;IACrB;IACAD,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAGA,IAAI,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC,UAAU,EAAE,IAA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,SAASoE,GAAG,CAAC3E,GAA0B,EAAE2B,GAAW,EAAEZ,OAAwB,EAAE;EACrFY,GAAG,GAAG,IAAAiD,mBAAa,EAACjD,GAAG,CAAC,GAAGA,GAAG,GAAG3B,GAAG,CAAC6E,eAAe,EAAE,GAAGlD,GAAG;EAC5D,IAAImD,UAAU,GAAG;IACfnD,GAAG,EAAEA,GAAG;IACRC,MAAM,EAAE;EACV,CAAC;EACDwB,MAAM,CAACC,MAAM,CAACyB,UAAU,EAAE/D,OAAO,CAAC;EAClC,OAAOS,WAAW,CAACxB,GAAG,EAAE8E,UAAU,CAAC;AACrC;AAEO,SAASC,IAAI,CAAC/E,GAA0B,EAAE2B,GAAW,EAAEE,IAAkB,EAAEd,OAAwB,EAAE;EAC1GY,GAAG,GAAG,IAAAiD,mBAAa,EAACjD,GAAG,CAAC,GAAGA,GAAG,GAAG3B,GAAG,CAAC6E,eAAe,EAAE,GAAGlD,GAAG;EAC5D,IAAIqD,WAAW,GAAG;IAChBrD,GAAG,EAAEA,GAAG;IACRC,MAAM,EAAE,MAAM;IACdC,IAAI,EAAEA,IAAI;IACVC,cAAc,EAAE;EAClB,CAAC;EACDsB,MAAM,CAACC,MAAM,CAAC2B,WAAW,EAAEjE,OAAO,CAAC;EACnC,OAAOS,WAAW,CAACxB,GAAG,EAAEgF,WAAW,CAAC;AACtC"}
1
+ {"version":3,"file":"request.js","names":["formatError","sdk","error","Error","AuthApiError","errorSummary","message","resp","err","serverErr","responseText","isString","JSON","parse","e","status","options","transformErrorXHR","clone","wwwAuthHeader","WWWAuthError","getWWWAuthenticateHeader","headers","error_description","OAuthError","wwwAuthErr","parseHeader","max_age","acr_values","parameters","errorCauses","errorDescription","scheme","httpRequest","httpRequestInterceptors","interceptor","url","method","args","saveAuthnState","accessToken","withCredentials","storageUtil","storage","httpCache","storageManager","getHttpCache","cookies","cacheResponse","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","Promise","resolve","response","oktaUserAgentHeader","_oktaUserAgent","getHttpHeader","Object","assign","removeNils","ajaxOptions","data","undefined","res","httpRequestClient","then","Array","isArray","forEach","item","stateToken","delete","STATE_TOKEN_KEY_NAME","set","updateStorage","Math","floor","DEFAULT_CACHE_DURATION","catch","errorCode","get","isAbsoluteUrl","getIssuerOrigin","getOptions","post","postOptions"],"sources":["../../../lib/http/request.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\n/* eslint-disable complexity */\nimport { isString, clone, isAbsoluteUrl, removeNils } from '../util';\nimport { STATE_TOKEN_KEY_NAME, DEFAULT_CACHE_DURATION } from '../constants';\nimport {\n OktaAuthHttpInterface,\n RequestOptions,\n FetchOptions,\n RequestData,\n HttpResponse\n} from './types';\nimport { AuthApiError, OAuthError, APIError, WWWAuthError } from '../errors';\n\n\nconst formatError = (sdk: OktaAuthHttpInterface, error: HttpResponse | Error): AuthApiError | OAuthError => {\n if (error instanceof Error) {\n // fetch() can throw exceptions\n // see https://developer.mozilla.org/en-US/docs/Web/API/fetch#exceptions\n return new AuthApiError({\n errorSummary: error.message,\n });\n }\n\n let resp: HttpResponse = error;\n let err: AuthApiError | OAuthError | WWWAuthError;\n let serverErr: Record<string, any> = {};\n if (resp.responseText && isString(resp.responseText)) {\n try {\n serverErr = JSON.parse(resp.responseText);\n } catch (e) {\n serverErr = {\n errorSummary: 'Unknown error'\n };\n }\n }\n\n if (resp.status >= 500) {\n serverErr.errorSummary = 'Unknown error';\n }\n\n if (sdk.options.transformErrorXHR) {\n resp = sdk.options.transformErrorXHR(clone(resp));\n }\n\n // \n const wwwAuthHeader = WWWAuthError.getWWWAuthenticateHeader(resp?.headers) ?? '';\n\n if (serverErr.error && serverErr.error_description) {\n err = new OAuthError(serverErr.error, serverErr.error_description, resp);\n } else {\n err = new AuthApiError(serverErr as APIError, resp, { wwwAuthHeader });\n }\n\n if (wwwAuthHeader && resp?.status >= 400 && resp?.status < 500) {\n const wwwAuthErr = WWWAuthError.parseHeader(wwwAuthHeader);\n // check for 403 to avoid breaking change\n if (resp.status === 403 && wwwAuthErr?.error === 'insufficient_authentication_context') {\n // eslint-disable-next-line camelcase\n const { max_age, acr_values } = wwwAuthErr.parameters;\n err = new AuthApiError(\n {\n errorSummary: wwwAuthErr.error,\n errorCauses: [{ errorSummary: wwwAuthErr.errorDescription }]\n },\n resp,\n {\n // eslint-disable-next-line camelcase\n max_age: +max_age,\n // eslint-disable-next-line camelcase\n ...(acr_values && { acr_values })\n }\n );\n }\n else if (wwwAuthErr?.scheme === 'DPoP') {\n err = wwwAuthErr;\n }\n // else {\n // // WWWAuthError.parseHeader may return null, only overwrite if !null\n // err = wwwAuthErr ?? err;\n // }\n }\n\n return err;\n};\n\nexport function httpRequest(sdk: OktaAuthHttpInterface, options: RequestOptions): Promise<any> {\n options = options || {};\n\n if (sdk.options.httpRequestInterceptors) {\n for (const interceptor of sdk.options.httpRequestInterceptors) {\n interceptor(options);\n }\n }\n\n var url = options.url,\n method = options.method,\n args = options.args,\n saveAuthnState = options.saveAuthnState,\n accessToken = options.accessToken,\n withCredentials = options.withCredentials === true, // default value is false\n storageUtil = sdk.options.storageUtil,\n storage = storageUtil!.storage,\n httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n if (options.cacheResponse) {\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[url as string];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n return Promise.resolve(cachedResponse.response);\n }\n }\n\n var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();\n var headers: HeadersInit = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n ...oktaUserAgentHeader\n };\n Object.assign(headers, sdk.options.headers, options.headers);\n headers = removeNils(headers) as HeadersInit;\n\n if (accessToken && isString(accessToken)) {\n headers['Authorization'] = 'Bearer ' + accessToken;\n }\n\n var ajaxOptions: FetchOptions = {\n headers,\n data: args || undefined,\n withCredentials\n };\n\n var err, res;\n return sdk.options.httpRequestClient!(method!, url!, ajaxOptions)\n .then(function(resp) {\n res = resp.responseText;\n if (res && isString(res)) {\n res = JSON.parse(res);\n if (res && typeof res === 'object' && !res.headers) {\n if (Array.isArray(res)) {\n res.forEach(item => {\n item.headers = resp.headers;\n });\n } else {\n res.headers = resp.headers;\n }\n }\n }\n\n if (saveAuthnState) {\n if (!res.stateToken) {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n }\n\n if (res && res.stateToken && res.expiresAt) {\n storage.set(STATE_TOKEN_KEY_NAME, res.stateToken, res.expiresAt, sdk.options.cookies!);\n }\n\n if (res && options.cacheResponse) {\n httpCache.updateStorage(url!, {\n expiresAt: Math.floor(Date.now()/1000) + DEFAULT_CACHE_DURATION,\n response: res\n });\n }\n \n return res;\n })\n .catch(function(resp) {\n err = formatError(sdk, resp);\n\n if (err.errorCode === 'E0000011') {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n\n throw err;\n });\n}\n\nexport function get(sdk: OktaAuthHttpInterface, url: string, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var getOptions = {\n url: url,\n method: 'GET'\n };\n Object.assign(getOptions, options);\n return httpRequest(sdk, getOptions);\n}\n\nexport function post(sdk: OktaAuthHttpInterface, url: string, args?: RequestData, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var postOptions = {\n url: url,\n method: 'POST',\n args: args,\n saveAuthnState: true\n };\n Object.assign(postOptions, options);\n return httpRequest(sdk, postOptions);\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