9

Im follow the react-hosted-login sample project here: https://github.com/okta/samples-js-react/tree/master/okta-hosted-login

I created my application in okta like so: Okta application configuration

I configured the react-sample appropriately

export default {
  oidc: {
    clientId: '0oaewvbvbyZdmYZb60h7',
    issuer: 'https://dev-572586.oktapreview.com/oauth2/default',
    redirectUri: 'http://localhost:8080/implicit/callback',
    scope: 'openid profile email',
  },
  resourceServer: {
    messagesUrl: 'http://localhost:8000/api/messages',
  },
};

When I run the app, I can successfully login when I click the login button in the react app. i.e It takes me to my okta sign-in page and redirects back with the access token and all that stuff

However, when the login is initiated from okta, I get the following error AuthSdkError: Unable to parse a token from the url:

Error in SPA

What am I doing wrong?

Krimson
  • 6,306
  • 9
  • 47
  • 86
  • Hmm, something doesn't look right. Can you open the browser's network console and trace the whole flow from start to finish? I'm interested to see what is being passed to Okta on the initial authorization request. – Nate Barbettini Jul 08 '19 at 17:40

2 Answers2

0

I can assume It's because your Login Redirect URL's and Initiate Login URL Are the same values on general setting of your app in okta

Sergey Rog
  • 11
  • 2
-1

One thing you might check:

Make sure you've got the @okta/okta-react package installed (NPM), you've imported the ImplicitCallback component, and your routing has the route to it:

leebrandt
  • 1,788
  • 1
  • 13
  • 21
  • I do, I'm running the example that okta has provided with no modifications at all. ImplicitCallback is imported and the router has provided a route to it. https://github.com/okta/samples-js-react/blob/master/okta-hosted-login/src/App.jsx – Krimson May 09 '18 at 02:40
  • 1
    @leebrandt seems as though your advice did't help – Box and Cox Jun 12 '19 at 06:35