I have a website from which I would like to post articles to my group in Vkontakte. The connection is normal, a window with rights confirmation pops up, but when you send a request containing the wall.post method, it gives error 15 (access to the method is denied). Here is the request for authorization

<a href="http://api.vkontakte.ru/oauth/authorize?client_id=<?=$vkontakteApplicationId?>&scope=offline,wall,groups&redirect_uri=http://<?=$sYourDomain?>&response_type=code">Авторизация Вконтакте</a> 

code wall.post:

$sRequest = "https://api.vkontakte.ru/method/wall.post?owner_id=$vkontakteGroupId=&from_grou‌​p=1&access_token=$vkontakteAccessToken&message=$text";

I did not try to convey anything except the message

  • one
    What wall.post code wall.post like? What do you use for publishing? After all, now wall.post is available only to Standalone-приложениям and web applications using the confirmation window: ClientAPI, OpenAPI и SDK vk.com/dev/api_confirm - Alexey Shimansky
  • In general, as I have already written, you must use ClientAPI, OpenAPI и SDK and you do not use them. - Alexey Shimansky
  • that besides this code: <script type="text/javascript"> VK.init({ apiId: xxxxxxxx }); </script> <script type="text/javascript"> VK.init({ apiId: xxxxxxxx }); </script> should be on my site to use OpenAPI - Vadim

2 answers 2

Recently, I wrote a module for posting to groups, so I will answer. You need to create a new standalone type application. For an application of this type, unfortunately, you cannot specify a domain (and thereby automate the receipt of temporary access tokens). Therefore, you need to get the "eternal" token manually.

Otherwise, everything is like yours:

https://api.vk.com/oauth/authorize?client_id=<?=$vkontakteApplicationId?>&scope=offline,wall,groups&redirect_uri=https://vk.com&response_type=code

Copy the code from the address bar, and make a request for a token:

https://oauth.vk.com/access_token?client_id=<?=$vkontakteApplicationId?>&client_secret=<?=$vkontakteApplicationSecret?>&redirect_uri=https://vk.com&code=<?=$code?>

Fortunately, in this case the token is not tied to an IP address (unlike the standard OAuth authorization), so it is possible to do these operations through a browser, and register the token in your application (for example, in a PHP script that works with a different IP).

    Maybe you forgot to add a "-" (minus) before the group ID?