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