385
Views
17
Comments
Solved
[Facebook Login Plugin] Cannot assign a JavaScript object with value [object Object] to an output parameter
Question
facebook-login-plugin
Mobile icon
Forge asset by Experts

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

UserImage.jpg
Kartick Srinivas
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,

2020-07-21 19-28-50
Rajat Agrawal
Champion

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

2015-09-28 00-04-44
Pedro Coelho

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





UserImage.jpg
Kartick Srinivas

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.

UserImage.jpg
Kartick Srinivas
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,

2015-09-28 00-04-44
Pedro Coelho

Any help guys?

2023-05-02 16-46-00
João Grazina

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


UserImage.jpg
ImPoke

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.

UserImage.jpg
ImPoke

fixed it


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

UserImage.jpg
Miguel Figueiredo

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 

UserImage.jpg
ImPoke

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

UserImage.jpg
Miguel Figueiredo

"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.

UserImage.jpg
ImPoke

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
            }]
        }
}


UserImage.jpg
Miguel Figueiredo

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
            }]
        }
}




UserImage.jpg
Miguel Figueiredo

One more question.

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

regards

UserImage.jpg
ImPoke

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

UserImage.jpg
Miguel Figueiredo

Thanks again for all your help DontPoke!

2023-05-02 16-46-00
João Grazina

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.