Ricki Ricardo
Posts: 0
Joined: Fri Nov 16, 2012 9:30 am

Not worknig redirect on iOS in childbrowser.

I use oAuth authorization. For this I use childbrowser. When I entered login and password, them opens page with access confirmation. When I press allow application show only loading. In android all work goods.
It's trouble only in iphone, iOS 6.1.3. I have no idea with this trouble.
Could you help me? May be it's iphone bug?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Not worknig redirect on iOS in childbrowser.

Hello! Sorry for delay, working on it.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Not worknig redirect on iOS in childbrowser.

Hi Ricki,

Did you try testing your app with oAuth in standard mobile browser without using ChildBrowser?

If you use onLocationChange event in your code then you should know the event works for Android and iPhone differently.

It dispatches on iPhone if there is a redirect to another address when open URL.

Ricki Ricardo
Posts: 0
Joined: Fri Nov 16, 2012 9:30 am

Not worknig redirect on iOS in childbrowser.

I open 1 address like box.com/authorize and them this site redirect to https page of my project. You mean that it will not work on ios?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Not worknig redirect on iOS in childbrowser.

Hi Ricki,

I mean something else.
If there is a navigation in Child browser to page URL1 and there is a redirect to URL2, then event "onLocationChange" will be dispatched two times on Android: for URL1 and URL2. Whereas on iOS it's dispatched only once - for URL2.

If your app depends on the event this might cause the problem with iOS.

Christine Stringfield
Posts: 0
Joined: Wed Apr 03, 2013 4:35 am

Not worknig redirect on iOS in childbrowser.

Hello, I am experiencing the same problem with the iOS version of my app. We have users login to Facebook with our app following the instructions in this tutorial: http://docs.appery.io/tutorials/build...

The JavaScript opens the Facebook login window in the childbrowser, however it seems like the the FB code that is returned is getting stored in the childbrowser localstorage, so that when the childbrowser closes, all my events based on the code and retrieving a FB access token fail. Is there a way to resolve this?

Please help!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Not worknig redirect on iOS in childbrowser.

Where do you invoke the script to save the token into local storage?

Christine Stringfield
Posts: 0
Joined: Wed Apr 03, 2013 4:35 am

Not worknig redirect on iOS in childbrowser.

On the startScreen I have this code:

var redirectUrl = 'http://appery.io/app/view/fcae492f-8c...';

var url = 'https://www.facebook.com/dialog/oauth...';
url += '&redirect_uri=' + redirectUrl;
url += '&scope=email,publish_actions';
url += '&state='+OAuth.nonce(17);

var cb = null;
if(window.plugins) {
cb = window.plugins.childBrowser;
}
if (cb != null) {
/* Wen native childBrowser plugin must be used to navigate to facebook. /
cb.onLocationChange = function (url) {
if(url.indexOf(redirectUrl) === 0) {
/ if user successfully logged in /
cb.close();
var vars = parseUrlVars(url);
localStorage.setItem('code', vars.code + '_'); / store secret code /
Appery.navigateTo('result', {reverse: false}); / Navigate to page 'result' */
}
};

Code: Select all

cb.showWebPage(url); 

}
else {
localStorage.setItem('code', '');
window.open(url);
};

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Not worknig redirect on iOS in childbrowser.

Looks like the code to save into local storage is invoked on this (parent) page, not in child browser.

Christine Stringfield
Posts: 0
Joined: Wed Apr 03, 2013 4:35 am

Not worknig redirect on iOS in childbrowser.

yes it is, however when the child browser closes, none of the services will execute because there is no code to retrieve. If we keep the child browser open and never close it, we can see that the user logs in fine, but this is beyond the point. We do not want to run our entire app in the child browser because then we won't be able to use the mobile camera. The code works fine in a desktop browser, but not on iOS. Anyway you could take a look at the app so you can see what we are experiencing in the iOS simulator?

Return to “Issues”