I have been able to reproduce all the code of Facebook Native Login with Foreign Code … however there is something that I am missing, the callback success should contain the return that came from the Facebook library, however the return comes with an empty object. And from what I saw there is not an onSuccess function, only a simple this.Resolve. Can someone help me with this?
Uno object properties are not automatically available in JavaScript.
I suggest that you add a NativeFunction to the FacebookLoginModule that takes the token as an argument.
The token argument to the NativeFunction will be of type Fuse.Scripting.External on the Uno side, which is a wrapped Uno object that is passed in from JavaScript. The External has an Object property to get the inner wrapped object, so to get back the AccessToken object, you’d do something like (args[0] as Fuse.Scripting.External).Object as AccessToken.
Once you have the AccessToken you can use foreign code to get its properties and return them back to JavaScript.
I’ve created an issue to improve this sample by showing how to do this.
As a code example this is ok… I’m trying to do this because this is the only missing method to publish my app.
But, as a real example logic for facebook, the Login function must result the data provided from facebook like clientid, access token, user data, etc. Don’t you think?
The hope is that the example is useful as starting point for using third-party SDKs but it is perhaps a little too minimal if considered as an example of using the Facebook SDK specifically.