4

I build API for post on my community of VK. But I check my permission for my app, and I have all permissions, but not load WALL permissions.

In the scope for OAuth, I put all scopes and not work the WALL. I check the "Api.console" and they have "Access to Wall - The application has access to your wall", but in my app not appear.

This is the response:

{"error":{"error_code":15,"error_msg":"Access denied: no access to call this method","request_params":[{"key":"oauth","value":"1"},{"key":"method","value":"wall.post"},{"key":"owner_id","value":"-*********"},{"key":"from_group","value":"1"},{"key":"message","value":"New post on group wall via API."}]}}

I check other services and if work.

Striezel
  • 3,693
  • 7
  • 23
  • 37
  • In my case (posting to a public page) it was the wrong `owner_id` value. I tried to use application ID, but I should have used the public page ID instead (with `-`, of course). – retif Mar 23 '18 at 21:09

2 Answers2

4

You can't call wall.post (and a lot of other methods) with a non-standalone applications. It seems like your VK application is of type Website or iFrame - they have limited access to the API methods.

However, while you can't call this method from non-standalone applications, can via the Open API (it's a JavaScript SDK for Website applications) or the JavaScript SDK for iFrame applications. When you call wall.post via these SDKs, a confirmation window will appear where the user needs to confirm the wall post before sending it:

Standalone applications are designed to be used in apps like mobile or desktop clients or browser extensions (because they don't have CORS limitations and may read any tab). There is absolutely no ways to get a user's standalone access token without limitations if you are trying to authorize them via website.

If you are building website or something and need wall.post for service purposes (e.g. news cross-posting), then you may get your token and save it anywhere in site configuration. Open this address:

https://oauth.vk.com/authorize?client_id={APP_ID}&scope={PERMISSIONS}&v={ACTUAL_API_VERSION}&response_type=token&redirect_uri=https://oauth.vk.com/blank.html
  • {APP_ID} - your standalone application ID (may be found in application Settings).
  • {PERMISSIONS} - comma-separated list of permissions. Don't forget the offline permission to get token that doesn't expire.
  • {ACTUAL_API_VERSION} - VK API version.

Example:

 https://oauth.vk.com/authorize?client_id=123456&scope=wall,offline&v=5.60&response_type=token&redirect_uri=https://oauth.vk.com/blank.html

Note that redirect_uri=https://oauth.vk.com/blank.html is required to get token without the above mentioned limitations.

After you grand your application access to your account, access token without limitations will appear in your browser address bar. Just copy it, save in your configs and feel free to call any methods you want.

Gianfranco P.
  • 10,049
  • 6
  • 51
  • 68
Petr Flaks
  • 543
  • 2
  • 7
  • 25
  • Yes i use "Standalone Application". and have a authorization oauth 2.0. i test using all scopes, but the error persist. and tested other methods and if working. – Smart Business Force Jan 06 '17 at 02:35
  • i put this scopes: notify,friends,photos,audio,video,pages,status,notes,wall,ads,offline,docs,groups,notifications,stats,email,market,manage and I have token. but the error is same – Smart Business Force Jan 06 '17 at 02:38
  • i compare api default that is "api.console" and my app, the first have this right: "Access to Wall - The application has access to your wall". But this not working on my app thinking that i have all scopes. – Smart Business Force Jan 06 '17 at 02:40
  • @SmartBusinessForce, did you try to get token via URL I gave you in the answer? Does your account have [2-step auth](https://vk.com/settings?act=security) enabled (not sure this matters but without 2-step auth there may be some problems with standalone apps)? – Petr Flaks Jan 06 '17 at 11:10
  • @Nakilon, check out here: [vk.com/dev/implicit_flow_user](https://vk.com/dev/implicit_flow_user). However sometime they changed URL a bit. I've updated the answer. – Petr Flaks May 17 '18 at 09:48
  • I'm using a website app for some reason I can only get the prompt for the wall scope if i use the redirect URL as `https://oauth.vk.com/blank.html` when i use my own redirect URL the wall permission disappears from the auth page – Uriahs Victor Aug 22 '20 at 19:29
  • After lots of trying with the official php sdk simply calling the two last URLs for e.g. news-cross-site worked finally – zyrup Nov 22 '22 at 18:24
0

Late but...for this you need to first create a sort of "demo" app for VK using the standalone app type which would issue you an access token inside the address bar when you set the redirect link to https://oauth.vk.com/blank.html

This access token would allow you to share to your personal profile wall.

Then you need to contact VK support and display your app in action. Once they approve it then you'd be able to use a "Website" app that has OAuth style authentication

Uriahs Victor
  • 1,049
  • 14
  • 32