Ejemplo n.º 1
0
 private Task OnAuthenticated(FacebookAuthenticatedContext facebookAuthenticatedContext)
 {
     var settingBusinessLogic = new SettingBusinessLogic(new SystemSettingRepository(new DatabaseFactory()));
     settingBusinessLogic.Add(new SystemSetting
     {
         Key = SettingKeyEnum.AccessToken.ToString(),
         Value = facebookAuthenticatedContext.AccessToken
     });
     return Task.FromResult(0);
 }
Ejemplo n.º 2
0
 public static void Authorize()
 {
     var fb = new FacebookClient();
     var appId = ConfigurationManager.AppSettings["AppId"];
     var appSecret = ConfigurationManager.AppSettings["AppSecret"];
     dynamic result = fb.Get("oauth/access_token", new
     {
         client_id = appId,
         client_secret = appSecret,
         grant_type = "client_credentials"
     });
     fb.AccessToken = result.access_token;
     var settingBusinessLogic = new SettingBusinessLogic(new SystemSettingRepository(new DatabaseFactory()));
     settingBusinessLogic.Add(new SystemSetting
     {
         Key = SettingKeyEnum.AccessToken.ToString(),
         Value = fb.AccessToken
     });
 }