Redirect facebook after login

Hi,

i am trying using Backendless stand alone with Ionic, i have setup the facebook login using javascript.

after the user login throw facebook the popup window not closed and it’s redirect to:
http://localhost:8080/api/v1/users/social/facebook/authorize/C4A54109-1911-FAA2-FFD5-76104D02B800?code=AQB_Cn5khvdzTh7kfWc6fE_Y06E_wmCOcW3f057MGE1QpKvWeYlQDZyOEcuiajkqTctE5n3BUJEMtci2pTm6c2ldMuIkjf7dLFenp9quIcCUFzwjok7jvSXxSsOH6xBlXBtpdBTf9IVCOd5fBhBofEzqxQPumMrzCtnfks1cdndAxT4SWhMk3d0XHjgXEXqLVEByMds_BJQg7hGAZ7RowtLcd9OP5INic7v4fULYhuyPDJEdzWtfUxR_oiT4DjbSXGOm0gY1ouKtcXLbJXZ2igbA8vfbJMlrIuXX-L6nOHd2fPbENlRB43UDqrLshZiVUaISArZxHCzQNgmIW9PFR5mp&state=1786039274#=

  • After login success it’s should be redirect to the app.
  • i am using the both enviroment localy (ionic and backendless).

here is the code that do login with facebook

function fbLogin() {
Backendless.UserService.loginWithFacebook(null, null, new Backendless.Async( successCallback, errorCallback ), null);
};
how i can solve this.

Thanks

There is no free support for standalone version, please contact sales@backendless.com to get information about support for standalone version.

Hi, I have same problem… use Ionic with backendless me too . When i test my app inside browser i haven’t problem but if i use it on device registration work but return white page with this error “Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘file://’) does not match the recipient window’s origin (‘https://api.backendless.com’).”

Have you used standalone version?

Hi, Valerio.
Could you try use loginWithFacebookSDK() method ? (you may need to connect the facebook library)

I have used Javascript guide in Backendless site with configuration explained https://backendless.com/documentation/manage/mgmt_social_settings.htm

the problem is not only facebook but for all social login… I noticed that when i execute Backendless.UserService.loginWithFacebook in browser start another page for login where request data for access and after registration it’s automatically close… Instead on device this page doesn’t close and remains blank with that mistake

Hi Oleg,

i tried both, loginWithFacebook() and loginWithFacebookSDK() methods and not working.

but loginWithFacebookSDK() method give me this response:

URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.

Thanks
Alaa

That’s an error from Facebook. See this:

Hi Sergey! do you have any idea?

Hi Oleg!

Problem isn’t loginWithFacebook or loginWithFacebookSDK method…I have same error for all social login I see that in requst_url from browser


    Origin:
    http://localhost:8100
instead from device
    Origin:file://
I think problem is here...

http://stackoverflow.com/a/42728565/2330272

To get the javascript method for social login using Backendless Javascript SDK 3.1.23 to work with Backendless Standalone version 3.X you need to make the following changes. If you are using local file system then will need to change below to support.

    Change SDK method _loginSocialin in the backendless.js file - the standalone Backendless.serverURL end with /api but e.origin is only the hostname, so if (e.origin == Backendless.serverURL) will never be true.
From
_loginSocial: function(socialType, fieldsMapping, permissions,
async, container, stayLoggedIn) {
.
.
Utils.addEvent('message', window, function(e) {
if (e.origin == Backendless.serverURL) {
var result = JSON.parse(e.data);


To

_loginSocial: function(socialType, fieldsMapping, permissions,
async, container, stayLoggedIn) {
.
.
Utils.addEvent('message', window, function(e) {
var pathArray = Backendless.serverURL.split("/");
var protocol = pathArray[0];
var host = pathArray[2];
var url = protocol + '//' + host;
if (e.origin == url) {
var result = JSON.parse(e.data);