Sign in to follow this  
tharuin

[web] Facebook integration in silverlight

Recommended Posts

Heyho,

I'm trying to implement facebook authentification to my silverlight application. I got everything set up on facebook and the application is already connected there.
While searching for some samples about how to manage that I didn't found any example which doesn't use an asp.net host application. Is there a way to actually manage this without having a windows server running...?

I found one example for Silverlight apps, but this one is only for Silverlight apps running out of browser, because of the Webbrowser-Control not working in-browser. ( http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-first-Facebook-Application.aspx ).

What I have so far is basically everything provided in that link, except the part where the browser comes in:

[code]
public string accesstoken;

public MainPage()
{
InitializeComponent();
LoginToFacebook();
}

void LoginToFacebook()
{
string appId = "app_id_here";
string[] extendedPermissions = new[] { "publish_stream", "offline_access" };

var oauth = new FacebookOAuthClient() { AppId = appId };
var parameters = new Dictionary<string, object>
{
{ "response_type", "code" },
{ "display", "popup" }
};

if (extendedPermissions != null && extendedPermissions.Length > 0)
{
var scope = new StringBuilder();
scope.Append(string.Join(",", extendedPermissions));
parameters["scope"] = scope.ToString();
}

var loginUrl = oauth.GetLoginUrl(parameters);
}

void oauth_GetApplicationAccessTokenCompleted(object sender, FacebookApiEventArgs e)
{
}
[/code]

I hope you can help me :(

Sincerely,
xbaalx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this