I’m building an Ionic app to interface with an existing backend, and attempting to integrate custom Auth since I already have users, a whole authentication system, and so on. I’ve followed the docs as closely as possible- and in fact, was able to call auth.login()
in my app, use the URL to authenticate on my own server, and register that user with ionic Auth! Unfortunately, I was only able to do so once before the behavior in the title began.
First- here’s my output of ionic info
:
Cordova CLI: 7.0.1 Ionic Framework Version: 3.2.1 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1.3.7 ios-deploy version: 1.9.1 ios-sim version: 6.0.0 OS: macOS Sierra Node Version: v7.4.0 Xcode version: Xcode 8.3.3 Build version 8E3004b
And here’s the simple login()
function I’m using:
login(email, password) {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let loginData = { 'email': email, 'password': password };
let loginOptions = { 'inAppBrowserOptions': {'hidden': true} }
return this.auth.login('custom', loginData, loginOptions).then(
(data) => {
console.log('ionic auth success');
console.log(JSON.stringify(data));
},
(error) => {
console.log('ionic auth error');
console.log(JSON.stringify(error));
}
);
}
}
Currently when I start the app in the iOS simulator and attempt to login, I see neither of these outputs- not even the error. When I use the --livereload
option, I’ve noticed that I see the following error immediately after every rebuild following a change, before I can even try to login:
ionic auth error
{"line":66485,"column":50,"sourceURL":"http://192.168.1.9:8100/build/main.js","__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}}
So somehow, my auth error function is occurring before I actually click login. Also, the error refers to the following section of main.js
:
var w_1 = window.cordova.InAppBrowser.open(res.body.data.url, '_blank', _this.parseInAppBrowserOptions(options.inAppBrowserOptions));
var onExit_1 = function () {
deferred.reject(new Error('InAppBrowser exit'));
};
var onLoadError_1 = function () {
deferred.reject(new Error('InAppBrowser loaderror'));
};
Specifically, onLoadError_1
is the function with the error - which I think means the plugin itself is breaking. I’m not sure how to approach this, especially since it worked once and then promptly stopped. Any help would be greatly appreciated, and if I’ve left out any relevant info, please let me know.