AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 372 forks source link

[Help wanted] Redirect flow + react-router #899

Closed ssuvorov closed 4 years ago

ssuvorov commented 4 years ago

Hey, I'm submitting a...

Library Name

I've created a repo based on react-sample-app which uses redirection for login. But I spent a few days just trying to make it work with "react-route-dom". The main problem was to keep the user on the same URL after login redirection happens. After the page is refreshed, the router library loses the state with the previous location. As a workaround, I used localStorage. And now I'm curious, is it a better way to do so.

Repository: https://github.com/ssuvorov/MS-SSO-react-example

My flow is the following:

Questions

  1. Is it possible to use auth.loginRedirect() from any path? I'd like to avoid redirection to /login. Currently, if I use login() from http://localhost:3000/protected it returns

    AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application

  2. What's the best way to stay on /protected page after redirection happens?
ssuvorov commented 4 years ago

I guess there is a better repo for asking this. Moved to: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/1474