M
M
maxsharun2019-09-11 17:36:24
API
maxsharun, 2019-09-11 17:36:24

Error 28 VK API Application authorization failed: refresh service token?

Hello,
So, by logging in to VK using a secure application code, having received the code, I also received an access_token.
Using the Access Token, I tried to publish a post on VK:

public function wallpost($vkids) {
    
      $title = 'My good`s Album';
      $description = 'In this Aplbum I publish goods.... If u see, I`d got it..';
      $privacy_view = 'all';
      $client_secret = 'xxxxxxxxxxxxxxxxxx';
      $comments_disabled = 1;
      $token = $vkids->access_token;
      $sURL = "https://api.vk.com/method/wall.post?client_secret={$client_secret}&message={$description}&owner_id={$vkids->vk_id}&v=5.101&access_token={$token}";
      $oResponce = json_decode($this->get_curl($sURL));
      return $sURL; //Эту ссылку я закидываю в браузер, чтобы читать ошибку (короче, для простоты)
    
  }


function get_curl($url) {
      if(function_exists('curl_init')) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        $output = curl_exec($ch);
        echo curl_error($ch);
        curl_close($ch);
        return $output;
        } else {
        return file_get_contents($url);
      }
    }

Those. I am making a request from this link:
https://api.vk.com/method/wall.post?client_secret=xxxxx&message=In this Aplbum I publish goods.... If u see, I`d got it..&owner_id=4254183&v=5.101&access_token=xxxxx

I tried without secret_codem, but with access_token, on the contrary, all at once, etc. One answer:
{"error":{"error_code":28,"error_msg":"Application authorization failed: refresh service token","request_params":[{"key":"client_secret","value":"xxxxxxxx"},{"key":"message","value":"In this Aplbum I publish goods.... If u see, I`d got it.."},{"key":"owner_id","value":"4254183"},{"key":"v","value":"5.101"},{"key":"method","value":"wall.post"},{"key":"oauth","value":"1"}]}}

The same song with an attempt to create an album, etc. Guys, I really need help, hung specifically. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
ystneris, 2019-09-11
@ystneris

I assume that you have an Embedded or Website application, and not a Standalone application. It is most likely related to this.
It is also worth checking the access_token, recreating it and checking again.

A
Anton Shamanov, 2019-09-11
@SilenceOfWinter

1. the ip from which you get the token must match the ip on which you use it - you can't log in from your computer, then later use it on the site
2. wallpost is only available in the Standalone application and when you receive the token, the scope must be 'wall,offline'
3. callback_uri = 'blank.html'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question