I am writing an application for VC, stuck at the authorization stage.
Sending a request to:
url = new URL("https://oauth.vk.com/"+ "authorize?client_id=5622141&"+ "display=page&"+ "redirect_uri=https://oauth.vk.com/blank.html&"+ "scope=friends&response_type=token&"+ "v=5.57&"+ "state=123456"); InputStream in = url.openStream(); Then I get the answer:
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in)); StringBuilder result = new StringBuilder(); String line; while((line = bufferedReader.readLine()) != null) {result.append(line);} The result was recorded redirect to the authorization page from where I had to pull out 2 values: String ip_h, to_h;
Then again I make a request with the received ip_h and to_h and there I also inserted my login and password from VC:
URL url2 = new URL("https://login.vk.com/?act=login&soft=1"+ "&q=1"+ "&ip_h="+ip_h+ "&from_host=oauth.vk.com"+ "&to="+to_h+ "&expire=0"+ "&email="+email+ "&pass="+password ); In response, a redirect comes saying: "The password or login is not entered correctly." The password already me, tried to use another page ... the problem remained.