Failing to redirect to route after logging in
See original GitHub issueIssue and Steps to Reproduce
Failing to redirect to specified page after being logged in, the page gets stuck with the callback url being filled -
I’ve tried to add the customCallback but that doesnt seem to resolve the issue, heres my current code -
App.js -
const CallbackSuccessComponent = () => {
const navigate = useNavigate();
const { idToken } = useOidcIdToken();
useEffect(() => {
console.log(idToken);
if (idToken) {
navigate("/automagiqapps/ui/dashboard", { replace: true });
window.location.reload();
}
}, [idToken]);
return <div>CallbackSuccessComponent</div>;
};
function App() {
const configuration = {
client_id: "<CLIENT_ID>",
redirect_uri: "${window.location.origin}/automagiqapps/ui/#callback",
scope: "openid profile",
authority:
"<AZURE_AUTH_URL>",
// service_worker_relative_url: "./OidcServiceWorker.js",
// service_worker_only: true,
};
return (
<OidcProvider
configuration={configuration}
callbackSuccessComponent={CallbackSuccessComponent}
>
<Router>
<SnackbarProvider
maxSnack={2}
autoHideDuration={2000}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
}}
>
<Routes>{routes}</Routes>
</SnackbarProvider>
</Router>
</OidcProvider>
);
}
Login logic, pretty much copied from examples -
{!isAuthenticated && (
<ListItemButton
sx={{ px: 3, pt: 2.5, pb: 2.5 }}
onClick={() => login("/automagiqapps/ui/dashboard")}
>
<ListItemIcon>
<LoginIcon />
</ListItemIcon>
<ListItemText
primary="Login"
primaryTypographyProps={{
fontSize: 15,
fontWeight: "medium",
variant: "body2",
}}
/>
</ListItemButton>
)}
Versions
"@axa-fr/react-oidc": "^6.10.13"
Screenshots
Expected
Redirected to specified route
Actual
Stuck on callback URL after pressing login and being authenticated
Additional Details
- Installed packages:
Issue Analytics
- State:
- Created 10 months ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Login/Redirect fails in production - Auth0 Community
I'm using Auth0 in an Angular app, and I just deployed a test build to production, where it fails outright upon login.
Read more >Fail to redirect to the previous page after authenticating the ...
I added in a middleware called isLoggedIn and I saved req.session.returnTo = req.originalUrl; and I passed in this middleware to 2 routes (get(' ......
Read more >Login Fails to Redirect when Using Custom URL - Laracasts
Hi,. I'm using Laravel 5.2 and I wish to change the login URL from the default /login to /adminLogin. Right now I have...
Read more >Unable to Redirect anywhere after login - Questions
my site stuck at this point ,not opening my secure routes (making single page React website)
Read more >After login user gets initially redirected to /code #3292 - GitHub
I got hash routing enabled and sometimes when the redirect is too slow my application tries to find the route /code which obviously...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any update on this @sharjeel-jan? i seem to have a simular issue
hi @sharjeel-jan, did you solve your problem?