Possible InAppBrowser issue on iOS

11 posts, 0 answers
  1. Ryan
    Ryan avatar
    43 posts
    Member since:
    Mar 2012

    Posted 21 May 2013 Link to this post

    I'm building a hybrid app using Telerik's Icenium platform.  I recently started integrating Kinvey for the app's backend and came across a strange issue.  Hoping you guys can shed some light on it.


    pretty much step by step.  I ended up using Cordova's InAppBrowser for my redirects to fb, google, twitter, etc.  Everything works fine on Android (testing on my HTC Droid DNA).  For example, when I log into facebook and allow my app to access my fb account, when it redirects back to whatever redirect URI I specified when I created the fb app the access tokens are appended to the url properly

    like so https://www.example.com/oauth#access_token=<access_token>&expires_in=<expires_in>  

    where "https://www.example.com" would be the redirect URI I specified when I created my app on fb, google, twitter etc.

    However when I run the same app on my iPhone 5 those access tokens aren't appended to the redirect URL...so I can't go get them and parse anything :(  The query string parameters are being stripped out or something??

    I tried my app both running through the Icenium Ion app and also after I provisioned my iPhone for development (not using Icenium Ion) and see the same thing.  Again, it only happens on iOS, Android appears to be fine

    I asked the Kinvey support guys about it and got back this response:

    "Does the redirect URI come back with no query strings at all? I would expect an error message at least. Is the code 200?
    Not sure what could be wrong, this has been used many times. There is no security setting in iOS that would cause stripping of query strings (assuming the response is not an error). 
    Did you ask the Icenium guys, they may have some clues."

    I haven't tried to use the ChildBrowser plugin and I really don't want to since the shiny new InAppBrowser is in there now :)
    I've since moved on from this issue but I can wire everything back up in my project if you guys need me to so you can try and reproduce this issue on your end.

    Just lemme know, and thanks in advance for any help
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 21 May 2013 Link to this post

    Hello Ryan,

    Thanks for the extensive information on the problem. It would be best if you setup a project that exhibits the problem so we can have a look at it and investigate where is the culprit. Just let us know of its name and we would look it up.

    All the best,
    Steve
    the Telerik team

    Don't miss the Icenium May Release Keynote - sign up now!
    Share feedback and vote for features on our Feedback Portal.
  3. Ryan
    Ryan avatar
    43 posts
    Member since:
    Mar 2012

    Posted 21 May 2013 Link to this post

    Okay lemme get it wired back up and working again.  When I do I'll reply to this thread with the info you need to test it out
  4. Ryan
    Ryan avatar
    43 posts
    Member since:
    Mar 2012

    Posted 21 May 2013 Link to this post

    alright I've only got one project (SweatLogs) tied to my gmail account: ryanday@sweatlogs.com  It's setup right now to do the oauth facebook login.  Use the "Facebook Login" button on the app's launch page to trigger the process.  That should redirect you to a facebook login.  facebook will redirect you back to "https://www.sweatlogs.com" once you approve the app.  On Android you should see the access tokens appended to that url as querystring parameters.  on iOS they won't be there.

    You guys can pull the code out of that app and create something separate to play with if you need to.  I'm actively working on this app so that'd probably be a good idea :)

    Any questions just lemme know, good luck
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 22 May 2013 Link to this post

    Hi Ryan,

    Your Facebook app is currently sand-boxed and I get access denied and app is sand-boxed errors. I could not find where Kinvey application credentials are stored, so I can for example try with the consumer key from our facebook sample app.

    Just for the sake of test, we've changed our sample facebook api app to use InAppBrowser instead of ChildBrowser plugin and it works correctly on both iOS and Android, so it is definitely not a problem with InAppBrowser. You can find the modified sample here.

    Regards,
    Steve
    Telerik

    Don't miss the Icenium May Release Keynote - sign up now!
    Share feedback and vote for features on our Feedback Portal.
  6. Ryan
    Ryan avatar
    43 posts
    Member since:
    Mar 2012

    Posted 22 May 2013 Link to this post

    crap sorry, I've got sandbox mode disabled now so you can give it a shot and it should be fine now.  I'll look at the sample provided in the meantime and see if anything jumps out at me
  7. Ryan
    Ryan avatar
    43 posts
    Member since:
    Mar 2012

    Posted 22 May 2013 Link to this post

    I don't have my iPhone handy right now but I'll run this test on it later today and give you my results.  I'm hoping it's just the fact that my app was in sandbox mode maybe that was causing the access tokens to not come back in the querystring parameters.  I've seen that error about an app being in sandbox mode but not with my fb app so who knows??  I'll post something tonight once I've done some more testing on my iPhone.  Really appreciate you guys redoing that sample with the InAppBrowser though, very helpful
  8. Ryan
    Ryan avatar
    2 posts
    Member since:
    Jan 2012

    Posted 22 May 2013 Link to this post

    okay so I got it working...oddly enough it was the redirect URI of "http://www.sweatlogs.com" that was causing issues on iOS.  Not sure exactly why just yet.  Something dumb about the webserver that's on I'm guessing??  At any rate I knew something bizarre was going when I plugged the settings for your test fb app into my icenium app and the Kinvey backend and everything worked fine on iOS and Android.  if I just change my redirect URI to match the one you guys use with your fb app (or just about anything else I imagine) everything works okay.  As soon as I try and change it to the sweatlogs.com domain iOS blows up on me again

    Thanks for working with me on this...glad there wasn't any bug in the end :-)
  9. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 23 May 2013 Link to this post

    Hi Ryan,

    We're glad that you were able to identify the problem and get your app running so you can continue your development.

    Regards,
    Steve
    Telerik

    Don't miss the Icenium May Release Keynote - sign up now!
    Share feedback and vote for features on our Feedback Portal.
  10. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 12 Jun 2013 Link to this post

    Does somebody have detailed information on how to set up an app in facebook?
  11. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 12 Jun 2013 Link to this post

    Hi JD,

    Did you look at the instructions on facebook here: https://developers.facebook.com/apps?

    Regards,
    Steve
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Missed our first webinar, watch it here.
    Share feedback and vote for features on our Feedback Portal.
Back to Top