diff --git a/CHANGELOG.md b/CHANGELOG.md index b52984ae..5c3cd07c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 6.4.2 + +### Bug Fixes + +- [#199](https://github.com/okta/okta-react/pull/199) Fixes okta-auth-js peer dependency error + # 6.4.1 ### Bug Fixes diff --git a/generated/samples/custom-login/package.json b/generated/samples/custom-login/package.json index 1997782b..fd2d577e 100644 --- a/generated/samples/custom-login/package.json +++ b/generated/samples/custom-login/package.json @@ -3,9 +3,9 @@ "version": "0.3.0", "private": true, "dependencies": { - "@okta/okta-auth-js": "^5.6.0", + "@okta/okta-auth-js": "^6.0.0", "@okta/okta-react": "*", - "@okta/okta-signin-widget": "^5.12.2", + "@okta/okta-signin-widget": "^6.0.0", "colors": "^1.4.0", "semantic-ui-css": "^2.4.1", "semantic-ui-react": "^2.0.3", diff --git a/generated/samples/doc-direct-auth/package.json b/generated/samples/doc-direct-auth/package.json index 44c1274c..10c186c6 100644 --- a/generated/samples/doc-direct-auth/package.json +++ b/generated/samples/doc-direct-auth/package.json @@ -3,7 +3,7 @@ "version": "0.3.0", "private": true, "dependencies": { - "@okta/okta-auth-js": "^5.6.0", + "@okta/okta-auth-js": "^6.0.0", "@okta/okta-react": "*", "react": "^16.8.0", "react-dom": "^16.8.0", diff --git a/generated/samples/doc-embedded-widget/package.json b/generated/samples/doc-embedded-widget/package.json index 07d3a0d1..4a787f76 100644 --- a/generated/samples/doc-embedded-widget/package.json +++ b/generated/samples/doc-embedded-widget/package.json @@ -3,9 +3,9 @@ "version": "0.3.0", "private": true, "dependencies": { - "@okta/okta-auth-js": "^5.6.0", + "@okta/okta-auth-js": "^6.0.0", "@okta/okta-react": "*", - "@okta/okta-signin-widget": "^5.12.2", + "@okta/okta-signin-widget": "^6.0.0", "react": "^16.8.0", "react-dom": "^16.8.0", "react-router-dom": "^5.2.0", diff --git a/generated/samples/okta-hosted-login/package.json b/generated/samples/okta-hosted-login/package.json index 28f93050..7fe2b4ef 100644 --- a/generated/samples/okta-hosted-login/package.json +++ b/generated/samples/okta-hosted-login/package.json @@ -3,7 +3,7 @@ "version": "0.3.0", "private": true, "dependencies": { - "@okta/okta-auth-js": "^5.6.0", + "@okta/okta-auth-js": "^6.0.0", "@okta/okta-react": "*", "colors": "^1.4.0", "semantic-ui-css": "^2.4.1", diff --git a/package.json b/package.json index a08ac385..e1f8a6b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@okta/okta-react", - "version": "6.4.1", + "version": "6.4.2", "description": "React support for Okta", "private": true, "scripts": { @@ -45,7 +45,7 @@ "compare-versions": "^4.1.2" }, "peerDependencies": { - "@okta/okta-auth-js": "^5.3.1", + "@okta/okta-auth-js": "^5.3.1 || ^6.0.0", "@types/react-router-dom": "^5.1.6", "react": ">=16.8.0", "react-dom": ">=16.8.0", diff --git a/src/LoginCallback.tsx b/src/LoginCallback.tsx index 029404ab..cfdce206 100644 --- a/src/LoginCallback.tsx +++ b/src/LoginCallback.tsx @@ -26,7 +26,10 @@ const LoginCallback: React.FC = ({ errorComponent, loadingEl const ErrorReporter = errorComponent || OktaError; React.useEffect(() => { - if (onAuthResume && oktaAuth.isInteractionRequired?.() ) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore OKTA-464505: backward compatibility support for auth-js@5 + const isInteractionRequired = oktaAuth.idx.isInteractionRequired || oktaAuth.isInteractionRequired.bind(oktaAuth); + if (onAuthResume && isInteractionRequired()) { onAuthResume(); return; } diff --git a/src/Security.tsx b/src/Security.tsx index d7979b96..aefdc52f 100644 --- a/src/Security.tsx +++ b/src/Security.tsx @@ -47,9 +47,9 @@ const Security: React.FC<{ if (oktaAuth.options.restoreOriginalUri && restoreOriginalUri) { console.warn('Two custom restoreOriginalUri callbacks are detected. The one from the OktaAuth configuration will be overridden by the provided restoreOriginalUri prop from the Security component.'); } - oktaAuth.options.restoreOriginalUri = async (oktaAuth: unknown, originalUri: string) => { + oktaAuth.options.restoreOriginalUri = (async (oktaAuth: unknown, originalUri: string) => { restoreOriginalUri(oktaAuth as OktaAuth, originalUri); - }; + }) as ((oktaAuth: OktaAuth, originalUri?: string) => Promise); // Add okta-react userAgent if (oktaAuth._oktaUserAgent) { diff --git a/test/e2e/harness/package.json b/test/e2e/harness/package.json index 35e494c4..11e0c96d 100644 --- a/test/e2e/harness/package.json +++ b/test/e2e/harness/package.json @@ -4,7 +4,7 @@ "version": "0.0.8", "private": true, "dependencies": { - "@okta/okta-auth-js": "^5.6.0", + "@okta/okta-auth-js": "^6.0.0", "@okta/okta-react": "*", "@types/node": "^14.14.7", "@types/react": "^16.9.56", diff --git a/test/jest/loginCallback.test.tsx b/test/jest/loginCallback.test.tsx index 86a93031..f8a5b7c8 100644 --- a/test/jest/loginCallback.test.tsx +++ b/test/jest/loginCallback.test.tsx @@ -33,9 +33,11 @@ describe('', () => { updateAuthState: jest.fn(), }, isLoginRedirect: jest.fn().mockImplementation(() => false), - isInteractionRequired: jest.fn().mockImplementation( () => false ), handleLoginRedirect: jest.fn().mockImplementation( () => Promise.resolve() ), start: jest.fn(), + idx: { + isInteractionRequired: jest.fn().mockImplementation( () => false ), + } }; mockProps = { oktaAuth, @@ -120,7 +122,7 @@ describe('', () => { }); it('will trigger a passed onAuthResume function when isInteractionRequired is true', () => { - oktaAuth.isInteractionRequired = jest.fn().mockImplementation( () => true ); + oktaAuth.idx.isInteractionRequired = jest.fn().mockImplementation( () => true ); const resumeFunction = jest.fn(); const wrapper = mount( @@ -153,7 +155,7 @@ describe('', () => { }); it('will treat isInteractionRequired like a normal error if not onAuthResume is passed', async () => { - oktaAuth.isInteractionRequired = jest.fn().mockImplementation( () => true ); + oktaAuth.idx.isInteractionRequired = jest.fn().mockImplementation( () => true ); const errorMsg = 'error on callback'; authState = { isAuthenticated: false @@ -212,7 +214,7 @@ describe('', () => { }); it('renders loading element if onAuthResume is passed', async () => { - oktaAuth.isInteractionRequired = jest.fn().mockImplementation( () => true ); + oktaAuth.idx.isInteractionRequired = jest.fn().mockImplementation( () => true ); const resumeFunction = jest.fn(); const MyLoadingElement = (

loading...

); jest.spyOn(React, 'useEffect').mockImplementation(f => f()) diff --git a/yarn.lock b/yarn.lock index 99f51908..c20b4150 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1149,14 +1149,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.14.5" "@babel/helper-plugin-utils" "^7.14.5" -"@babel/polyfill@^7.10.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.12.1.tgz#1f2d6371d1261bbd961f3c5d5909150e12d0bd96" - integrity sha512-X0pi0V6gxLi6lFZpGmeNa4zxtwEmCs42isWLNjZZDE0Y8yVfgu0T2OAHlzBbdYlqbW/YXVvoBHpATEM+goCj8g== - dependencies: - core-js "^2.6.5" - regenerator-runtime "^0.13.4" - "@babel/preset-env@7.12.1": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.12.1.tgz#9c7e5ca82a19efc865384bb4989148d2ee5d7ac2" @@ -1471,7 +1463,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.10.4", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.4", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": version "7.15.3" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.3.tgz#2e1c2880ca118e5b2f9988322bd8a7656a32502b" integrity sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA== @@ -2056,13 +2048,13 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@okta/okta-auth-js@^5.6.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@okta/okta-auth-js/-/okta-auth-js-5.6.0.tgz#0a0b46dbd679ab0777bf338e0ab81ff1dcca1a7f" - integrity sha512-FwGJ2tFAl7matIcIoWA6FuwHXkcaMJhV7b7ENPoB6ftcFQHFItm/S5vf5G7g6wIep0ZTHOA7I8loIOE+TtzEBw== +"@okta/okta-auth-js@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@okta/okta-auth-js/-/okta-auth-js-6.0.0.tgz#5ec34f7d92f6c91a3efeef8a6441175693b6fa74" + integrity sha512-ivvAJJKxYKIWIP1dP7Fz8M2j29ie3N+mJ39q4WAWYuUuyzdhmzAWYTIMrUowDsn/6bARDEj6HcIsXHZhFMqEqQ== dependencies: "@babel/runtime" "^7.12.5" - "@okta/okta-idx-js" "0.19.0" + "@okta/okta-idx-js" "0.24.0" "@peculiar/webcrypto" "1.1.6" Base64 "1.1.0" atob "^2.1.2" @@ -2077,25 +2069,24 @@ webcrypto-shim "^0.1.5" xhr2 "0.1.3" -"@okta/okta-idx-js@0.19.0": - version "0.19.0" - resolved "https://registry.yarnpkg.com/@okta/okta-idx-js/-/okta-idx-js-0.19.0.tgz#f54a6692e530c481d41fac8f4e6d9d1f07683ff5" - integrity sha512-gtgPXIA5w/fQH5rqI1ZjrMhTE+seKSj1Xb5ryzeqW/+1YIo630pzk/JPZ1Svc8yth92uxN9M9wJLTYyUcdzI5w== +"@okta/okta-idx-js@0.24.0": + version "0.24.0" + resolved "https://registry.yarnpkg.com/@okta/okta-idx-js/-/okta-idx-js-0.24.0.tgz#f7c048a866add49f40fde0e25734fe61998be7c3" + integrity sha512-ut4LPYvsXKKQm+PVgsGuoeU1RzVteNHrZPYvhz7REJEaNkY7pKUPBmYxsq9zyjRyzEEkAH7YrWeyhMcW8Lpt9w== dependencies: "@babel/runtime" "^7.12.5" "@babel/runtime-corejs3" "^7.12.5" core-js "^3.15.1" jsonpath-plus "^5.1.0" -"@okta/okta-signin-widget@^5.12.2": - version "5.12.2" - resolved "https://registry.yarnpkg.com/@okta/okta-signin-widget/-/okta-signin-widget-5.12.2.tgz#979384e082d29b56528532c3f0a078ba6f3dbd66" - integrity sha512-0vpSBYiW6lHRWOtqYYAfQ1etevg6yuC3hvC/V9MIXEWCQ9fkFZDtCzPRzIclMyeEplZJZYohGRs2sxOmNa/dYQ== +"@okta/okta-signin-widget@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@okta/okta-signin-widget/-/okta-signin-widget-6.0.0.tgz#493a54e19c79a76614e073028c8dcab5491d59e1" + integrity sha512-nsSKRGeA96YfIX+96gJq4Q0ibiUTDnDA0aOJ7dEYVikLy1pq8aEWrc8VxFG218uVVLd4w38EqHBE4osLpCaiow== dependencies: - "@babel/polyfill" "^7.10.1" - "@babel/runtime" "^7.10.3" - cross-fetch "^3.0.4" + cross-fetch "^3.1.5" handlebars "^4.5.3" + jasmine "^4.0.1" q "1.4.1" u2f-api-polyfill "0.4.3" underscore "1.13.1" @@ -5501,7 +5492,7 @@ core-js-pure@^3.16.0: resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.16.1.tgz#b997df2669c957a5b29f06e95813a171f993592e" integrity sha512-TyofCdMzx0KMhi84mVRS8rL1XsRk2SPUNz2azmth53iRN0/08Uim9fdhQTaZTG1LqaXHYVci4RDHka6WrXfnvg== -core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0, core-js@^2.6.5: +core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0: version "2.6.12" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== @@ -5586,13 +5577,20 @@ cross-env@^7.0.3: dependencies: cross-spawn "^7.0.1" -cross-fetch@^3.0.4, cross-fetch@^3.0.6: +cross-fetch@^3.0.6: version "3.1.4" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.4.tgz#9723f3a3a247bf8b89039f3a380a9244e8fa2f39" integrity sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ== dependencies: node-fetch "2.6.1" +cross-fetch@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" + integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== + dependencies: + node-fetch "2.6.7" + cross-spawn-with-kill@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cross-spawn-with-kill/-/cross-spawn-with-kill-1.0.0.tgz#6d76b7bbfd148eb10bd0322fceb180ea9b0477a8" @@ -9931,6 +9929,11 @@ jake@^10.6.1: filelist "^1.0.1" minimatch "^3.0.4" +jasmine-core@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-4.0.0.tgz#8299ed38a100c47a1d154af63449a40967a7be5c" + integrity sha512-tq24OCqHElgU9KDpb/8O21r1IfotgjIzalfW9eCmRR40LZpvwXT68iariIyayMwi0m98RDt16aljdbwK0sBMmQ== + jasmine-core@~2.6.2: version "2.6.4" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.6.4.tgz#dec926cd0a9fa287fb6db5c755fa487e74cecac5" @@ -9972,6 +9975,14 @@ jasmine@2.8.0: glob "^7.0.6" jasmine-core "~2.8.0" +jasmine@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-4.0.2.tgz#6f5ff7fbf6b67f56600235fdb7d299ac52876c4b" + integrity sha512-YsrgxJQEggxzByYe4j68eQLOiQeSrPDYGv4sHhGBp3c6HHdq+uPXeAQ73kOAQpdLZ3/0zN7x/TZTloqeE1/qIA== + dependencies: + glob "^7.1.6" + jasmine-core "^4.0.0" + jasminewd2@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/jasminewd2/-/jasminewd2-2.2.0.tgz#e37cf0b17f199cce23bea71b2039395246b4ec4e" @@ -12165,6 +12176,13 @@ node-fetch@2.6.1: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== +node-fetch@2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + node-forge@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" @@ -16676,6 +16694,11 @@ tr46@^2.1.0: dependencies: punycode "^2.1.1" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + tryer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" @@ -17391,6 +17414,11 @@ webdriver-manager@^12.0.6, webdriver-manager@^12.1.4: semver "^5.3.0" xml2js "^0.4.17" +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" @@ -17639,6 +17667,14 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8"