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

Redirect the user to the page he is trying to access by having it in the browser memory #288

Open
sneha-boopal opened this issue Jan 8, 2021 · 1 comment

Comments

@sneha-boopal
Copy link

Requirement is that after a user logs in via Azure AD (or any identity provider really), they should be redirected to the page they tried to access. Meaning a flow like this:

User tries to access http://localhost:3000/products
App redirects them to log in with Azure AD
3)User is redirected back to the application, and should now see the product list instead of getting redirected to index page(http://localhost/products).
I tried by adding http://localhost:3000/products in redirectUri but still it is getting redirected to http://localhost:3000.
Is it achievable using msal and please provide if there are any sample apps

@jasonnutter
Copy link

I'm not sure about via react-aad-msal APIs, but MSAL supports passing the redirectStartPage parameter, which tells MSAL where to navigate after coming back from the redirect. Note, this requires auth.navigateToLoginRequestUrl to be enabled.

This is how we do it in MSAL Angular: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-angular-v1/lib/msal-angular/src/msal-guard.service.ts#L75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants