I’m trying to determine whether it’s an obvious bug or something more. I am trying to set up OAuth using Satellizer, it works in the browser but on Android I get an Application Error.
net::ERR_CONNECTION_REFUSED(http://localhost:8100…) I’m thinking it could be a few things, my API back end is running on a local machine, it’s broadcasting to a LAN address. I can connect to it in the android browser but maybe it’s an issue with my back end refusing connection? CORs is enabled so I checked that. It could be something to do with Ionic and passing the wrong port? I’m experienced with Angular but really new to Ionic/Cordova. I’ve followed a few different OAuth tuts and none of them seem to mention this error and my Google fu has been no help.
The process is thus, tap opens oauth window, accept permissions, this is where the browser diverges from the app, in the browser the window closes, the app sends out a request for auth to the back end and the user is logged in. In the app on the device it closes and immediately gives me the connection refused error.
Either help with the issue or help pointing me in the right direction would be really truly appreciated.
EDIT:
I tested the local auth and it connects to the back end fine, so it has to be related to the redirect window. Is it an issue of using the wrong origin?
I just finished integrating w/ Satellizer. email login is working fine (of course no new browser windows for that), and Facebook works fine in the browser. But when I emulate iOS the Facebook login craps out after I login w/ Facebook. I’ll post here when I figure it out.
I’m tied up w/ other things but from this and other things I’ve read I thought maybe I needed the inapp browser. Gave it a quick try and didn’t seem to fix the problem.
I know there was a blog post about how popular oauth login was for Ionic but I haven’t seen any actual working solutions yet that don’t require signing up for a third party service.
One of the more well known production apps HabitRPG requires you too do a weird hack manually to make it work.
I’m having the same problem when I get redirected by Instagram API. Works fine on browser, but in Android it gives me this same error for localhost. Any tips?
Those having problem can you try to use http://localhost/callback as fb callback with
cordova plugin add org.apache.cordova.inappbrowser in app browser with location=no
I also got the message net::ERR_CONNECTION_REFUSED(http://localhost/?code=...) when I tried to login facebook in my ionic + satellizer mobile app. Eventually I realized I should set $authProvider.platform = 'mobile' and it worked.