Dan
Dan

Reputation: 123

How to get the AccessToken in Facebook.Client v0.9.91-alpha

I'm trying to publish to a user's feed, and I've got Login working using the facebook.net SDK. I've installed both the Facebook and Facebook.Client nuget packages.

This line of code isn't working for me:

var fbClient = new Facebook.FacebookClient(_loginButton.CurrentSession.AccessToken);

Specifically, .CurrentSession does not exist as a property on the LoginButton class. Without it, I can't get the AccessToken, and can't publish to a user's wall.

What's the right way to do this in Facebook.Client 0.9.91-alpha?

Upvotes: 0

Views: 173

Answers (1)

Dan
Dan

Reputation: 123

After some trial and error, I believe I've found the answer. The AccessToken is now accessible via Session.ActiveSession.CurrentAccessTokenData.AccessToken, which means the line of code should be:

var token = Session.ActiveSession.CurrentAccessTokenData.AccessToken;
var fbClient = new Facebook.FacebookClient(token);

Upvotes: 1

Related Questions