[Facebook Login Plugin] Cannot assign a JavaScript object with value [object Object] to an output parameter

[Facebook Login Plugin] Cannot assign a JavaScript object with value [object Object] to an output parameter

  
Forge Component
(1)
Published on 18 Apr by Grazina
1 vote
Published on 18 Apr by Grazina

Hi,

I'm implementing the facebook login but when calling the login action I get this error: 

Cannot assign a JavaScript object with value [object Object] to an output parameter of type Text Check the JavaScript node 'Login' of the action 'FacebookLogin'.


Can someone help?


Thanks,

Pedro

When u implementing facebook did you check auth n token key because it is very imp.

Please clearify more about your problem, I'll try to help u

Hi,


I found the javascript issue, login through facebook is failing and the issue is on $parameters.ErrorMessage = msg; I did the replace by $parameters.ErrorMessage = JSON.stringify(msg); and the error no longer appears.

But the message returned on function failure is: [object Object] 

How do I identify the error message?

Pedro





Hi,

I also got this error, but not for all mobile devices, but for some like motorala, xiomi devices, etc. It is working fine for iOS, samsung S7, etc..

Can some one please tell on how to fix this ?

Also I noticed from the above reply, Rajat mentioned about auth n token key, but we do not set auth and token key, it is automatically taken care by the plugin, we only set the app id in the configurations. It doesn't ask for secret key also. Some one correct me if I am wrong in this.

Any help guys?

Solution

Kartick Srinivas wrote:

Hi,

I also got this error, but not for all mobile devices, but for some like motorala, xiomi devices, etc. It is working fine for iOS, samsung S7, etc..

Can some one please tell on how to fix this ?

Also I noticed from the above reply, Rajat mentioned about auth n token key, but we do not set auth and token key, it is automatically taken care by the plugin, we only set the app id in the configurations. It doesn't ask for secret key also. Some one correct me if I am wrong in this.

Hi Pedro,

I unstalled the app and installed it again in xiomi Mi, it worked fine. Please try doing the same, also please check the facebook app id in the configurations of FacebookLogin plug in,

Solution

Pedro Coelho wrote:

Any help guys?

Hi Pedro, 


I've pushed a new version. It has your JSON.serialize fix there, thank you. I'm also interested in the condition under which the error occurs. 

Did you solve the issue? Can you replicate it? On which device? What are your configurations?


Kind Regards,

João Grazina


I'm getting the same error, I changed the app Id from the configuration file, but I'm still getting the error on OnePlus 3 and Samsung S6.

Im leaving the permissions empty and they are being filled with the default permissions.

As mentioned before the app secret is never mentioned in the application.

fixed it


I had to Generate the app again after changing the configuration file

I'm having this same problem and didn't found a solution for it.

Using an Aquaris U phone (Android 7.1.1) for the tests.

Any help?

Regards 

Works with this in the Login node (FaceBookLogin action)


facebookConnectPlugin.login(JSON.parse($parameters.Permissions),
    function (userData) {
        //console.log(JSON.stringify(userData));
        $parameters.Success = true;
        $parameters.ErrorMessage = "";
        $parameters.ResultObject = JSON.stringify(userData);
        $resolve();
    },
    function (msg) {
        //console.log(msg);
        $parameters.Success = false;
        $parameters.ErrorMessage = JSON.stringify(msg);
        $parameters.ResultObject = "";
        $resolve();
    }
);


Also remember to fill in the app id in the configuration file and  to re-generate and re-install the application

"fill in the app id in the configuration file" is this done in the client app or in the FacebookPlugin Module? I think maybe I've missed this part.

Miguel Figueiredo wrote:

"fill in the app id in the configuration file" is this done in the client app or in the FacebookPlugin Module? I think maybe I've missed this part.

In the FaceBook Plugin Module - extensibility configuration

{
    "plugin":
        {
            "url": "https://github.com/OutSystemsExperts/cordova-plugin-facebook4#OS.0.11.0",
            "variables": [{
                "name": "APP_ID",
                "value": "345011912529327" <---------- This here
            },{
                "name": "APP_NAME",
                "value": "OutSystems Test"  <---------- And this
            }]
        }
}


Thanks DontPoke!


Regards


DontPoke wrote:

Miguel Figueiredo wrote:

"fill in the app id in the configuration file" is this done in the client app or in the FacebookPlugin Module? I think maybe I've missed this part.

In the FaceBook Plugin Module - extensibility configuration

{
    "plugin":
        {
            "url": "https://github.com/OutSystemsExperts/cordova-plugin-facebook4#OS.0.11.0",
            "variables": [{
                "name": "APP_ID",
                "value": "345011912529327" <---------- This here
            },{
                "name": "APP_NAME",
                "value": "OutSystems Test"  <---------- And this
            }]
        }
}




One more question.

How should I do the configuration if this module will be used by different apps in development?

regards

Since you will map the facebook users in the UserFacebook Entity, you will need a facebookModule for every different app.

Thanks again for all your help DontPoke!

Hello guys,

Glad the solution was provided. 

I'm considering going in the same path as Google Login Plugin, having the consumer applications define the actual Extensibility settings, instead of having it in the Plugin and requiring a clone to be able to use across different applications within the same environment.

Next version!

Kind Regards,

João Grazina