V
V
Victor2016-06-01 13:53:34
C++ / C#
Victor, 2016-06-01 13:53:34

Authorization c # vk_api, how can I do it?

I compiled this code, but the token variable contains only the login.vk.com page code I
use xNet

public static void auth(string login, string passw)
        {
            using (var net = new HttpRequest())
            {

                net.UserAgent = Http.ChromeUserAgent();
                CookieDictionary cookie = new CookieDictionary(false); 
                net.Cookies = cookie; 
                string result;

                net.Post(String.Format("https://login.vk.com/?act=logi&email={0}&pass={1}", login, passw)); //авторизация
                string token = net.Get("https://oauth.vk.com/authorize?client_id=5487405&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=friends&response_type=token&v=5.52").ToString(); // запрос токена
                net.AllowAutoRedirect = false; 
                MessageBox.Show(token);
            }
        }

What's wrong here?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2016-06-01
@victoriously

It has long been done "in a tricky way", if you open this link in a browser, then make sure that with this approach you will either have to do an analysis using Fiddler, Wireshark, etc., and then fake all the necessary requests and process redirects, parse, etc., or use WebBrowser, it's easier and better, this option is "official".

D
Dmitry Skogorev, 2016-06-01
@EnterSandman

act=logi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question