Page 2 of 3

Issue with Facebook API

Posted: Mon Jul 07, 2014 10:45 pm
by Cody Blue

Hi Illya,

There is nothing wrong with callbackURL: I've checked it.

I tried a few different things and found that unchecking "render all pages in one HTML" in app settings solves the problem.

Any insight any as to why this is the case, and if I needed the pages to be in one HTML, how should I go about resolving Facebook login?

Thanks.


Issue with Facebook API

Posted: Tue Jul 08, 2014 1:06 am
by Yurii Orishchuk

Hi Cody,

Please try wrap your "callbackUrl" into "encodeURIComponent" function.

The problem is you don't escape some characters that's should be escaped.

For example you should be code:

pre

var url = "https://www.facebook.com/dialog/oauth...=" + Facebook_Settings['client_id'] + "&redirect_uri=" + encodeURIComponent(callbackUrl) + "&scope=publish_actions&response_type=token";

/pre

Regards.


Issue with Facebook API

Posted: Tue Jul 08, 2014 10:53 pm
by Cody Blue

Hi Yurii,

No luck with that either - I get a black response screen as attached. As I indicated, unchecking "render all pages in one HTML" in app settings solves my problem, but I don't want to do that since some of CSS parameters are globally tied to all pages of the project.

I've shared project with support@appery, so you could take a look as well.

Regards, and look forward to your feedback,

Image


Issue with Facebook API

Posted: Wed Jul 09, 2014 11:51 pm
by Yurii Orishchuk

Hi Cody,

I've check your app and have following result:

There is some incompatibility in faceBook login processing with jqm render all pages in one template feature.

But i've found workaround for you, please follow it to get it work:

1 Use following code instead of yours:

pre

Code: Select all

     var callbackUrl = "http://appery.io/app/view/" + Facebook_Settings.project_id + "/Login.html?targetPage=Facebook_Me"; 

     var url = "https://www.facebook.com/dialog/oauth?client_id=" + Facebook_Settings['client_id'] + "&redirect_uri=" + encodeURIComponent(callbackUrl) + "&scope=publish_actions&response_type=token"; 

/pre

2 Open your login page and add "page show" js event handler with following code:

pre

var search = window.location.search;

var currentPageExec = /targetPage\=([^

var search = window.location.search;

var currentPageExec = /targetPage\=([\&\#]+)/gi.exec(search);

if(currentPageExec && currentPageExec[1]){
Apperyio.navigateTo(currentPageExec[1]);
};

\#]+)/gi.exec(search);

if(currentPageExec && currentPageExec[1]){
Apperyio.navigateTo(currentPageExec[1]);
};

/pre

That's all.

Regards.


Issue with Facebook API

Posted: Thu Jul 10, 2014 12:21 am
by Cody Blue

Hi Yurii,

Thanks for taking a look into the issue, and suggesting resolution.

I believe undesired characters have showed up in login page show code above. Would it be possible to share a clear version?

Regards.


Issue with Facebook API

Posted: Thu Jul 10, 2014 3:30 am
by Yurii Orishchuk

Cody,

Sorry for this inconvenience that was special characters escaping issue.

1 Use following code instead of yours:

precode

var callbackUrl = "http://appery.io/app/view/" + Facebook_Settings.project_id + "/Login.html?targetPage=Facebook_Me&quot

var url = "https://www.facebook.com/dialog/oauth?client_id=" + Facebook_Settings['client_id'] + "&redirect_uri=" + encodeURIComponent(callbackUrl) + "&scope=publish_actions&response_type=token&quot

/code/pre

2 Open your login page and add "page show" js event handler with following code:

precode

var search = window.location.search;

var currentPageExec = /targetPage\=([\&\#]+)/gi.exec(search);

if(currentPageExec && currentPageExec[1]){
Apperyio.navigateTo(currentPageExec[1]);
};

/code/pre

Regards.


Issue with Facebook API

Posted: Thu Jul 10, 2014 4:03 am
by Cody Blue

Yurii,

Thank you but same issue still. Please see the second code snippet with unwanted characters.

Regards.


Issue with Facebook API

Posted: Thu Jul 10, 2014 4:38 am
by Yurii Orishchuk

Cody,

Please try this file:

http://www.datafilehost.com/get.php?f...

Regards.


Issue with Facebook API

Posted: Wed Jul 16, 2014 3:49 am
by Cody Blue

Yurii,

I've encountered a problem with this implementation. The login with Facebook works fine.

After a successful login with facebook and navigation to main page, user can now choose to logout (via panel menu) - in this case I set the access_token to null and make the app navigate back to Login page. The erroneous behavior is that after logout and navigation back to Login page, the page is displayed only momentarily but shortly thereafter the app navigates to main page automatically (this shouldn't happen of course and the expected behavior is to remain on Login page) - I suspect that there is a chance that this is due the code above.

I've shared the project with support@appery and had provided details per our direct discussion on the thread above. Please let me know if you have any questions or I can clarify anything.

Here are the steps to reproduce the issue:

1) Open project and click on login with facebook
2) click on menu and press logout
3) The expected behavior is for the Login page to show. But instead the app automatically navigates back to main page, after momentary show of login page.

Will appreciate your help.
Regards.


Issue with Facebook API

Posted: Wed Jul 16, 2014 11:11 pm
by Yurii Orishchuk

Hi Cody,

currently you use this code for "exit" button:

pre

Code: Select all

 Appery.navigateTo('Login', {}); 

/pre

You need to use following one instead:

pre

Appery.navigateTo('Login', {reloadPage: true, transition: 'none'});

/pre

Regards.