Hi Team,
i am integrating Okta OpenId authentication by following examples from
implicit callback is not redirecting to the Secure route component. kindly support in this regard.
Thank you.
App.js
const App = () => {const dispatch = useDispatch();
const history = useHistory();
const onAuthRequired = () => {
history.push(‘/’);
};
useEffect(() => {
// dispatch(initUserData());
}, [dispatch]);return (
<Suspense fallback={<DelayedFallback/>}> <ErrorBoundary> <BrowserRouter> <Security issuer='https://dev-1234.okta.com/oauth2/default' clientId='0oa1234mzr4x6' redirectUri={`${window.location.origin}/implicit/callback`} onAuthRequired={onAuthRequired} pkce={false}> <Switch> {/*<Route exact path="/" component={Login}/>*/} <Route path='/' render={() => <SignIn issuer='https://dev-712342.okta.com/oauth2/default'/>}/> <SecureRoute path="list" component={List}/> <Route path="*" to={NotFound}/> <Route path='/implicit/callback' component={LoginCallback}/> </Switch> </Security> </BrowserRouter> </ErrorBoundary> </Suspense>
);
};
SignIn.js
const SignIn = ({ issuer }) => {
const { authState } = useOktaAuth();if (authState.isPending) { return <div>Loading...</div>; } return authState.isAuthenticated ? <Redirect to={{ pathname: '/list' }}/> : <Login issuer={issuer} />;
};
export default SignIn;
Debug information
- Request URL:
Request Method:GET
Status Code: 302 Found
Remote Address:3.15.XX.XXX.XX
Referrer Policy:no-referrer-when-downgrade
client_id:0oaw9yngiop43amzr4x6
nonce:VU65oT9xIusJKpEe7Xo1HUuSFBiL7nbD2MbyIFdsQ9lcA65heirGg4ObDnSQlNsF
redirect_uri:http://localhost:3000/implicit/callback
response_type:id_token token
sessionToken:20111-hra2XUAI-Gf5HeEvdSPD3fK1kC74ahq6LrMy24Jj4362QC9jf
state:APWZEee9EGxGnokfq9sPGVA3DplgpNupkWi94aENX8VkStIHssyTubZ1SB5D0JSi
scope:openid email profile