Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function launchInAppBrowser(authURL, interactive, callback) {
var openInAppBrowser = require('cordova-plugin-inappbrowser.inappbrowser');
var oAuthBrowser = openInAppBrowser(authURL, '_blank', 'hidden=yes');
var success = false;
var timeoutid;
oAuthBrowser.addEventListener('loadstart', function(event) {
if (success)
return;
if (timeoutid)
timeoutid = clearTimeout(timeoutid);
var newLoc = event.url;
// When the location address starts with our redirect URL, we're done.
if (newLoc.indexOf(exports.getRedirectURL()) === 0) {
success = true;
}
if (success) {
oAuthBrowser.close();