Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on redirect from login #221

Open
negreanucalin opened this issue Apr 7, 2022 · 1 comment
Open

Error on redirect from login #221

negreanucalin opened this issue Apr 7, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@negreanucalin
Copy link

negreanucalin commented Apr 7, 2022

Describe the bug?

When the user is redirected from Okta login the SDK does not redirect user.

What is expected to happen?

User is redirected to the main page with no exception in console.
SDK should redirect when route matches:

What is the actual behavior?

  1. The user is not redirected to the main page "/"
  2. Exception in console:
    at Object.postMessage (webpack-internal:///./node_modules/broadcast-channel/dist/esbrowser/methods/native.js:39:21)
    at eval (webpack-internal:///./node_modules/broadcast-channel/dist/esbrowser/broadcast-channel.js:208:47)
postMessage @ native.js?b7d0:26
eval @ broadcast-channel.js?e27c:198
Promise.then (async)
eval @ broadcast-channel.js?e27c:202
Promise.then (async)
_post @ broadcast-channel.js?e27c:197
postInternal @ broadcast-channel.js?e27c:112
_sendMessage @ leader-election.js?a603:311
eval @ leader-election.js?a603:158
Promise.then (async)
applyRun @ leader-election.js?a603:157
eval @ leader-election.js?a603:183
Promise.then (async)
applyOnce @ leader-election.js?a603:182
eval @ leader-election.js?a603:252
_awaitLeadershipOnce @ leader-election.js?a603:238
awaitLeadership @ leader-election.js?a603:195
startElector @ esm.browser.js?5ec2:3598
start @ esm.browser.js?5ec2:3532
start @ esm.browser.js?5ec2:8857
eval @ okta-react.esm.js?554b:96                                                          <----- 
invokePassiveEffectCreate @ react-dom.development.js?ac89:23487
callCallback @ react-dom.development.js?ac89:3945
invokeGuardedCallbackDev @ react-dom.development.js?ac89:3994
invokeGuardedCallback @ react-dom.development.js?ac89:4056
flushPassiveEffectsImpl @ react-dom.development.js?ac89:23574
unstable_runWithPriority @ scheduler.development.js?bcd2:468
runWithPriority$1 @ react-dom.development.js?ac89:11276
flushPassiveEffects @ react-dom.development.js?ac89:23447
eval @ react-dom.development.js?ac89:23324
workLoop @ scheduler.development.js?bcd2:417
flushWork @ scheduler.development.js?bcd2:390
performWorkUntilDeadline @ scheduler.development.js?bcd2:157```


### Reproduction Steps?

When Okta redirects the user to my application with the url:
https://myReactApplication.com/login/callback?iss=https%3A%2F%2F8x8.okta.com 
Guessing the iss part comes from the okta dashboard.

### SDK Versions

6.4.3

### Execution Environment

Chrome 99.0.4844.84
Node v16.14.2
Windows 10 Pro 21H1

Part of package.json:
```     "axios": "^0.25",
        "axios-hooks": "^3.0.1",
        "chart.js": "^3.5.1",
        "chartjs-plugin-zoom": "^1.2.0",
        "date-fns": "^2.27.0",
        "date-fns-tz": "^1.2.2",
        "lodash.debounce": "^4.0.8",
        "react": "^17.0.2",
        "react-dom": "^17.0.2",
        "react-joyride": "^2.4.0",
        "react-redux": "^7.2.5",
        "react-router-dom": "^5.3.0",
        "react-table": "^7.7.0",
        "sass": "^1.43.2",
        "sass-loader": "^12.2.0",
        "styled-components": "^5.3.3",
        "typescript": "^4.5.5",
        "ua-parser-js": "^1.0.2"

### Additional Information?

Simplified code which show the issue as well:

    const restoreOriginalUri = useCallback(async (_oktaAuth, originalUri) => {
        try {
            history.replace(toRelativeUrl(originalUri || '/', window.location.origin));
        } catch (e) {
            console.log(e);
        }
    }, []);

    return <Security oktaAuth={oktaAuthInstance} restoreOriginalUri={restoreOriginalUri}>
        <Route path='/login/callback' component={LoginCallback}/>
    </Security>
    

    const AppWithRouterAccess = () => (
        <Provider store={store}>
            <Router>
                <App/>
             </Router>
        </Provider> 
     );
     ReactDOM.render(<React.StrictMode><AppWithRouterAccess/></React.StrictMode>, document.getElementById('app')); 
@eddiemonge
Copy link

You don't have a route matching the path /.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants