M
M
Maxim Plotnikov2019-07-13 14:10:49
PHP
Maxim Plotnikov, 2019-07-13 14:10:49

Why is an error returned from the VK API?

Good day.
Today I became interested in this method -> https://vk.com/dev/wall.post
When sending a request to create a post, an error 27 comes. The error itself is "The community access key is invalid."
This is how I make a request to create a post.

if ($message == 'Пост') {
        $i_parse = $vk->request('wall.post', ['access_token' => 'мой токен', 'owner_id' => '-184407589', 'message' => 'New post on group wall via API.console.']);
        $i = json_encode($i_parse);
        $vk->sendMessage($peer_id,"OK\n $i\n");
    }

What comes in response.
{"error":{"error_code":27,"error_msg":"Group authorization failed: method is unavailable with group auth.","request_params":[{"key":"method","value":"wall.post"},{"key":"oauth","value":"1"},{"key":"owner_id","value":"-184407589"},{"key":"message","value":"New post on group wall via API.console."},{"key":"v","value":"5.81"}]}}

But the strangest thing is that the community key is correct, and the key for this method is also created correctly.
What could be wrong? In the code or in some of the keys?
Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2019-07-13
@kakisaebalsujit

method is unavailable with group auth

"Method not available with community token."
Look at the documentation of the wall.post() method , the very first paragraph. The only option is to run wall.post():
Register the Standalone application, get the group admin token through it, and post entries with the parameter from_group=1to on behalf of the group.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question