Answer the question
In order to leave comments, you need to log in
How can I log in to Vknotakte from two accounts in one application?
I use the VK.NET
library .
I log in using the LoginIn function.
private void LoginIn(VkApi vk, string login, string password)
{
vk.Authorize(new ApiAuthParams
{
ApplicationId = AppID,
Login = login,
Password = password,
Settings = Settings.All
});
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private VkApi vk1 = new VkApi(), vk2 = new VkApi();
#region logins
private void LoginIn(VkApi vk, string login, string password)
{
vk.Authorize(new ApiAuthParams
{
ApplicationId = 5427437,
Login = login,
Password = password,
Settings = Settings.All
});
}
private void CheckBox1_Checked(object sender, RoutedEventArgs e)
{
LoginIn(vk1, Login1.Text, Password1.Text);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
vk1.Status.Set("1");
vk2.Status.Set("2");
}
private void CheckBox2_Checked(object sender, RoutedEventArgs e)
{
LoginIn(vk2, Login2.Text, Password2.Text);
}
#endregion
}
Answer the question
In order to leave comments, you need to log in
The library sources are on github, why not look at the implementation and get information about the native (REST) VK API?
if (!authorization.IsAuthorized)
{
throw new VkApiAuthorizationException("Invalid authorization with {0} - {1}", emailOrPhone, password);
}
...
public bool IsAuthorized => !string.IsNullOrWhiteSpace(AccessToken);
....
private string AccessToken
{ get; set; }
Create an array of objects that will store the object of each element of this VK.NET library (authorized)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question