I am trying to perform oAuth authentication in a PhoneGap app for iOS. I ran into the following problem. I primarily tested this for Google oAuth, but tried LinkedIn also with similar results:
- I can launch InAppBrowser, log in to my Google account and allow the application access to my account.
- InAppBrowser successfully returns an access token, expires, etc. When the application tries to send the access token back, I get the following error in Xcode:
webView: didFailLoadWithError - -1004: Failed to connect to the server.
This happens when I run the application on either an iOS simulator or actually an iPhone.
What I tried:
- I tried several different code samples, including what oauth.io provides as a code sample for their maintenance.
- Install Xcode on a separate computer and try there.
- Trying an old version of Phonegap
Interestingly, this happens when I have a "redirect URI":
http:
.. as defined by the Google APIs Console, and all the OAuth implementation tutorials that I went through. Obviously, the InAppBrowser code should stop the page loading and capture the data that is added to the URL bar. If I change the redirection to another value that the Google console provides (urn: ietf: wg: oauth: 2.0: oob), it redirects to the actual page with instructions for copying and pasting the code from the input into my URL string. Which does not help me in the context of InAppBrowser.
I am at a loss what to try next. Any suggestions?
source share