You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using oidc.ensureAuthenticated as a middlewear, you support a redirectTo param to redirect a user to a (dynamically set) route after a successful authentication callback. When oidc.ensureAuthenticated fails the authentication attempt (due to a missing/invalid/expired cookie etc.), it always redirects the request to the pre-configured fixed routes.login.path route.
Expected behavior
I'd like to be able to dynamically set a route to go to upon a failed authentication callback (e.g. via a new failedRedirectTo param on oidc.ensureAuthenticated).
Minimal reproduction of the problem with instructions
A standard usage of oidc.ensureAuthenticated as a middlewear on any route, e.g. -
Extra information about the use case/user story you are trying to implement
Consider the following scenario - we want to know what is the original target route of a user that attempts to login but has no session. Eventually when the user is able to login, we want to seamlessly navigate him to his original target route.
If there was a theoretical failedRedirectTo param, I could dynamically "persist" the original target route (dynamically extracted from req.originalUrl for example) via a query param like so:
This would redirect the request to our login page with the added nextUrl query param, such that eventually when the user is authenticated, he will be navigated inside the app to his original target route (obviously it will be different route for different users).
Environment
Package Version: Package Version: 2.0.0
Node version (node -v): 8.x, 10.x
The text was updated successfully, but these errors were encountered:
I'm submitting this issue for the package(s):
I'm submitting a:
Current behavior
When using
oidc.ensureAuthenticated
as a middlewear, you support aredirectTo
param to redirect a user to a (dynamically set) route after a successful authentication callback. Whenoidc.ensureAuthenticated
fails the authentication attempt (due to a missing/invalid/expired cookie etc.), it always redirects the request to the pre-configured fixedroutes.login.path
route.Expected behavior
I'd like to be able to dynamically set a route to go to upon a failed authentication callback (e.g. via a new
failedRedirectTo
param onoidc.ensureAuthenticated
).Minimal reproduction of the problem with instructions
A standard usage of
oidc.ensureAuthenticated
as a middlewear on any route, e.g. -Extra information about the use case/user story you are trying to implement
Consider the following scenario - we want to know what is the original target route of a user that attempts to login but has no session. Eventually when the user is able to login, we want to seamlessly navigate him to his original target route.
If there was a theoretical
failedRedirectTo
param, I could dynamically "persist" the original target route (dynamically extracted fromreq.originalUrl
for example) via a query param like so:This would redirect the request to our login page with the added
nextUrl
query param, such that eventually when the user is authenticated, he will be navigated inside the app to his original target route (obviously it will be different route for different users).Environment
node -v
): 8.x, 10.xThe text was updated successfully, but these errors were encountered: