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

Redirect after Login does not work as expected. (Vue App) #761

Closed HofmT closed 4 years ago

HofmT commented 6 years ago

Hello,

I have a Vue App with Webpack that I want to secure with ADAL. My Vue App has a separate Log-In page to initiate the login process with Azure AD. After a successful login I want the user to be redirected to the root index ('/'). In order to achieve that I set my redirectUri to http://127.0.0.1:8081/ and also set the config variable navigateToLoginRequestUrl to false.

Now what happens after a login is that I do get redirected to the root index however the page ist completely blank. There is no error but the content of the site is simply not loaded.

Does anyone have an idea how to approach this issue? Does it have something to do with Webpack or with Adal?

I appreciate any help. Thank you!

Kind regards Tobias

HofmT commented 6 years ago

Just found out that I can set a callback attribute inside the config of the AuthenticationContext. This callback gets called after the login in AAD. Inside the callback I simply do a manual page refresh with location.reload() and now it seems to work. However this approach does not seem clean to me.

So I'd be happy to hear any further suggestions. Thanks

EDIT Unfortunately, it does not work reliably. In Firefox I get stuck in a reloading process and in Chrome it sometimes only works in the second try.

nehaagrawal commented 6 years ago

@HofmT we have never seen this issue. Is there a sample which we can use to reproduce this at our end?

HofmT commented 6 years ago

I am not aware of any public sample but I recommend to copy the settings that I used meaning setting navigateToLoginRequestUrl to false and have a redirectUri that is different from the loginpage path.

sameerag commented 4 years ago

All current authentication work from microsoft is delivered through msal js library here. adal js is still supported only for security fixes. We would recommend to move to msal js for any advanced feature asks.

andreav commented 4 years ago

Hello @HofmT did you solve this issue? I have the exact same problem (white page) and i cannot understand why.

The page works correctly if I visit it directly but it is not rendered (it is blank) when arriving from ADFS login.

Any help is appreciated.

HofmT commented 4 years ago

Hello @HofmT did you solve this issue? I have the exact same problem (white page) and i cannot understand why.

The page works correctly if I visit it directly but it is not rendered (it is blank) when arriving from ADFS login.

Any help is appreciated.

Sorry, I'm not working on this project anymore and cannot really remember what the state was at the end...

andreav commented 4 years ago

No problem, thank you for you response, I solved the issue with this:

https://github.com/matt-ankerson/vue-adal/issues/2#issuecomment-461271623

Interestingly, a response to an issue of yours! 😄