A
A
Artur Kosikov2021-06-19 12:27:07
API
Artur Kosikov, 2021-06-19 12:27:07

How to get a valid access_token for a post on the VK wall?

I'm trying to post on the wall of the VK page.
First I make a request here:

https://oauth.vk.com/access_token?client_id=XXXX&c...

I get an access_token (string, 71 characters) in response.
Then I use it for wall.post.
I get an error:
"error_code":28,"error_msg":"Application authorization failed: access_token has expired."


I tried to use the "Service access key" from the application settings - it says that it is not suitable for wall.post ("method is unavailable with service token")

If you get it this way:
https://oauth.vk.com/authorize?client_id= XXXX&scop...
and copy the token from the address bar, then when accessing wall.post from the server, it gives the error "access_token was given to another ip address"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kruchinin, 2021-06-19
@malfixfx

And it may also depend on AJAX if you use JavaScript then use XHR(XmlHttpRequest)
Code example:

var xhr = new XMLHttpRequest();
var url = 'YOUR URL';
xhr.open('POST', url);
xhr.send();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question