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

page Double refreshing using ADAL.js #865

Closed lax-github closed 4 years ago

lax-github commented 5 years ago

I am trying to call Secured Azure Function App(OAuth 2.0) using ADAL js. I am getting the token but it redirects twice to https://login.microsoftonline.com (refreshing page twice.). It’s a bad user experience. Did anyone had same experience using ADAL.js?

Please provide some suggestion/solution. Thank you in advanced.

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Browser:

Library Name

Library version

Library version: 1.0.12

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

nvigne commented 5 years ago

Can you share a code example? From what you are describing, it looks like you are not correctly checking if the user is already authenticated.

var user = authenticationContext.getCachedUser();
if (user) {
    // Use the logged in user information to call your own api
    onLogin(null, user);
}
else {
    // Initiate login
    authenticationContext.login();
}
jmckennon commented 4 years ago

If you're still having issues, please comment here or open a new ticket, though we recommend moving to msal js.

All current authentication work from Microsoft is delivered through the msal js library here. adal js is still supported only for security fixes. We recommend moving to msal js for any advanced feature requests and bugfixes.