Advertisement
kepo4ka

Untitled

Mar 20th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. static int appId = 123456; // указываем id приложения
  2.         static string email = "test@mail.ru"; // email для авторизации
  3.         static string password = "test"; // пароль
  4.         static long? _ownerid = -12345678;
  5.  
  6.         static void Main(string[] args)
  7.         {
  8.           Like();
  9.         }
  10.        
  11.         static VkApi authVk()
  12.         {
  13.             Settings scope = Settings.All; //ошибка 401
  14.             // Settings scope = Settings.Wall; //Ошибки не будет
  15.  
  16.             var vk_api = new VkApi();
  17.             vk_api.Authorize(new ApiAuthParams
  18.             {
  19.                 ApplicationId = (ulong)appId,
  20.                 Login = email,
  21.                 Password = password,
  22.                 Settings = scope
  23.             });
  24.            
  25.             return vk_api;
  26.         }
  27.  
  28.         static void Like ()
  29.         {
  30.             var vk_api = authVk();
  31.             vk_api.Likes.Add(new LikesAddParams
  32.             {
  33.                 Type = LikeObjectType.Post,
  34.                 ItemId = 5073,
  35.                 OwnerId = _ownerid,
  36.                 AccessKey = vk_api.Token
  37.            
  38.             });
  39.             Console.WriteLine("goodlike");
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement