-
Notifications
You must be signed in to change notification settings - Fork 50
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
Doesnt seem to work when use popUp = true #25
Comments
I made it work without re-initializing adal but by subscribing to route change event. This works because when you set the config as below with poup and isangular to true, it changes the main window url and appends hash to it (you can code of this in adal.js, search for isAngular context)
I basically subscribe to route change event before calling adalService.login() and unsubscribe immediately after the route change, it goes something like this
Tested couple of scenarios and it holds good as of now.. |
@kaleemxii That seems like a lot more work then just passing in a callback and calling init again from the callback |
@slubowsky do you mind sharing your implementation? i am running into the same issue. thx! |
@slubowsky @kaleemxii i tried both your approaches and it didnt work for me. Basically i can see the callback trigger back but inside the callback, it seems the user is not authenticated yet! apprecaite some suggestions here. thanks! |
@mazhisai I no longer do it that way, Instead I have added a function to the adalService (I find that I have to rebuild it anyway or it causes problems) In any event here's my code with the old way calling adalService.init added back but commented out and replaced with a call to adalService.refreshDataFromCache. I tried to leave only the minimum necessary and removed all my other code. Hopefully whats left actually works..
The config object being passed in looks something like this:
|
@slubowsky thanks a lot for your response, much appreciated. let me give it a try and let you know if that fixed my issue :) |
@slubowsky thanks again for the help, i had to fork the code as well to add refreshDataFromCache() to get past the issue. |
I have put together a sample app that shows how to use the popUp library. https://github.com/mazhisai/ng2-adal-QuickStart. Also the change needed in the library is merged as part of #35 PR |
Will this work inside an ionic app using cordova? Is the popup you are referring to an HTML popup window? I'm trying to authenticate using this library inside a hybrid app and it opens an instance of the default browser app on the device, which cannot redirect back to the actual app that needs authentication. Anyone know how to do this? I know I can use Cordova In App Browser plugin, but the Adal js library knows nothing about it, so it doesn't work. |
Looks like AdalService.handleWindowCallback isn't called when using popup (and cant call it manually as hash wont be found) so updateDataFromCache is never called and userInfo never gets set to be authenticated. Recalling AdalService.init from config.callback to pick up the info from storage seems to be a workaround for now.
The text was updated successfully, but these errors were encountered: