Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 10th, 2011  |  syntax: C#  |  size: 1.11 KB  |  views: 67  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  public partial class MainPage : UserControl
  2.     {
  3.         public string accesstoken;
  4.  
  5.         public MainPage()
  6.         {
  7.             InitializeComponent();
  8.             LoginToFacebook();
  9.         }
  10.  
  11.         void LoginToFacebook()
  12.         {
  13.             string appId = "app_id";
  14.             string[] extendedPermissions = new[] { "publish_stream", "offline_access" };
  15.  
  16.             var oauth = new FacebookOAuthClient() { AppId = appId };
  17.             var parameters = new Dictionary<string, object>
  18.                 {
  19.                     { "response_type", "code" },
  20.                     { "display", "popup" }
  21.                 };
  22.  
  23.             if (extendedPermissions != null && extendedPermissions.Length > 0)
  24.             {
  25.                 var scope = new StringBuilder();
  26.                 scope.Append(string.Join(",", extendedPermissions));
  27.                 parameters["scope"] = scope.ToString();
  28.             }
  29.  
  30.             var loginUrl = oauth.GetLoginUrl(parameters);
  31.         }
  32.  
  33.         void oauth_GetApplicationAccessTokenCompleted(object sender, FacebookApiEventArgs e)
  34.         {
  35.         }
  36.     }
  37.  
  38.