About Native FacebookLogin

Hi!

I need some help with the UNO External Object.

I’m currently trying console.log(JSON.stringify(token)) and console.dir(token) but it return {}.

How I get access this Object in JavaScript?

What is the correct syntax for that?

MainView.ux

var FacebookLogin = require("FacebookLogin");
var Observable = require("FuseJS/Observable");

var message = o('Nothing...')

function login() {
		FacebookLogin.login().then(function(token) {
			message.value = "Login successful"
			console.log(JSON.stringify(token))
			console.dir(token)

		}, function(err) {
			message.value = "Login failed: " + err
		});
}

module.exports = {
		message: message,
		login: login
};

I need to use next parameters:
userID, permissions, tokenString, expirationDate from FBSDKAccessToken (link) from JS.

FacebookLogin/FacebookLoginModule.uno

	External Converter(Context context, FacebookLogin.AccessToken accessToken)
	{
		return new External(accessToken);
	}

Thank you!

Perhaps this can offer some hints? https://github.com/bolav/fuse-facebook-login

Bent Stamnes wrote:

Perhaps this can offer some hints? GitHub - bolav/fuse-facebook

Thanks, but not good enough for me:

  • Only iOS support for now. (Android on the list).
  • Only FB-button support. (Custom button coming).

Didn’t mean it was complete, just that it could possibly help with your implementation. :slight_smile:

Bent Stamnes wrote:

Didn’t mean it was complete, just that it could possibly help with your implementation. :slight_smile:

I like the cross-platform solution from the Fuse team (link). But I can’t obtain the necessary data from JS.

Can you recommend something?

Hey Keiby,

The way External works is that it’s a JS object that holds a reference to an Uno object, but it’s completely opaque on the JS side. This means that you can’t really do anything with it other than pass it around on the JS side. So what you’ll have to do is to pass it to one or several Uno methods, exposed to JavaScript, that extract the information that you need.

I hope that made sense!

Cheers!