A
A
AlekseyNechaev2013-11-22 12:41:24
API
AlekseyNechaev, 2013-11-22 12:41:24

Vk.api, wall.post on a third party site

There is a site, I want to post messages on the wall of groups from users from it.
Created a standalone application. I got a token, but when I call wall.post I get an error:
"Permission to perform this action is denied for non-standalone applications: you should request token using blank.html page"
If I specify https://oauth.vk in the redirect. com/blank.html, then the application will not be able to parse the token.
How to get around this problem? For example, http://buzzlike.ru/ somehow posts messages.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan, 2013-11-22
@L3n1n

If I specify https://oauth.vk.com/blank.html in the redirect , then the application will not be able to parse the token.

Why don't you parse it?
Here is a working php example
$cl = new HTTP_Client;
$cl->setDefaultHeader("Accept-Encoding", "identity");
$cl->get("https://oauth.vk.com/authorize?client_id=xxx&scope=video,groups,photos,wall,offline&display=wap&redirect_uri=https://oauth.vk.com/blank.html&response_type=token"); 

$resp = $cl->currentResponse();

$dom = str_get_dom($resp['body']);
$postData = array();
foreach ($dom->find("input") as $input)
{
  if ($input->name)
  {
    $postData[$input->name] = $input->value;
  }
}
$postData['email'] = $urow['login'];
$postData['pass'] = $urow['pass'];
$postData['expire'] = '0';

$cl->post($dom->find("form", 0)->action, $postData);
$resp = $cl->currentResponse();
if (strstr($resp['url'], "oauth.vk.com/blank.htm"))
{
  $oauth_success_url = $resp['url'];
}
else
{
  $dom->__destruct();
  unset($dom);
  $dom = str_get_dom($resp['body']);
  $cl->get($dom->find("form", 0)->action);
  $resp = $cl->currentResponse();
  $oauth_success_url = $resp['url'];
}
if (!preg_match("#access_token=([0-9a-f]+)&#", $oauth_success_url, $m))
{
  printf("Не удалось авторизоваться vk\n");
  exit(1);
}
$access_token = $m[1];
echo $access_token."\r\n";

E
Evgeny Seleznev, 2013-11-22
@alkali

Write to the administration or one of the developers, they will issue permission if you justify the need well, otherwise nothing.
ps we solved this issue personally through Vlad Tsyplukhin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question