Reputation: 8711
We are trying to integrate the SAML authentication in mobile apps(HybridCordova+angular JS)
I have tried below approach, Approach : Step 1: Mobile application open InAppBrowser -> Load the SP url -> Automatically SP URL redirects to IDP(any). to show the login page.(window.open("url")) Step 2: Once login successful in IDP, Inappbrowser should dismiss and back to mobile app.
To achieve the Step 2, I have tried to used "LoadStart","LoadStop" listeners. But it dismiss the browser before login gets successful.
Any idea? How to achieve this?
$scope.opensaml = function(){
appBrowser = window.open("https://example.com/login”, '_blank', 'location=no,closebuttoncaption=Back to App');
appBrowser.addEventListener('loadstart', function (event) {
console.log("Load Start",event.url)
});
appBrowser.addEventListener('loadstop', function (event) {
console.log("Load Stop",event.url);
appBrowser.close();
});
appBrowser.addEventListener('loaderror', function (event) {
console.log("Load Error",event.url)
});
}
Upvotes: 0
Views: 726
Reputation: 10636
loadstop: event fires when the InAppBrowser finishes loading a URL.
You are closing the InAppBrowser as soon as it's done loading your page. You should use instead
message: event fires when the InAppBrowser receives a message posted from the page loaded inside the InAppBrowser Webview.
That is of course conditional to the fact that you can trigger a message event on your login page.
Upvotes: 1