我试图通过their OAuth2 API从vKontakte(俄罗斯社交网络)获取访问令牌。 这就是我打电话的方式:
https://oauth.vk.com/authorize?client_id=12345&scope=wall,offline&redirect_uri=https://www.example.com/oauth/vk.php&display=page&v=5.24&response_type=token
我收到了访问令牌,但如果我尝试使用它发帖,我就收到此错误:
//error: Permission to perform this action is denied for non-standalone applications: you should request token using blank.html page.
我的应用是一个独立的应用程序 - 为什么我收到错误?
答案 0 :(得分:3)
我看到你的“client_id”是“12345” - 这是假身份证还是真假身份证?你从VK获得了有效的client_id吗?
您似乎应该通过“blank.html”请求令牌:
https://oauth.vk.com/authorize?client_id=<app_id>&scope=...,wall,...&redirect_uri=https://oauth.vk.com/blank.html&response_type=token
(而不是vk.php,在你的例子中)
答案 1 :(得分:2)
您遵循的步骤是正确的。
警告信息Please do not copy the data from the address bar to third-party sites. So you can lose access to your account.
将显示在屏幕上。然而,实际的访问令牌将在地址栏中找到。
答案 2 :(得分:0)
这就是它所说的-您不能对非独立应用程序使用隐式流。相反,您应该使用授权代码流,这对于客户端应用程序更安全。
答案 3 :(得分:0)
经过长时间的研究,我了解到允许在用户墙上张贴的 access_token 位于此页面的 URL https://oauth.vk.com/blank.html 中,而在此页面上则向用户发出警报
<块引用>请勿将地址栏中的数据复制到第三方站点。 因此,您可能无法访问自己的帐户。
因此作为开发人员,我必须说服用户 vk 是错误的,并且您必须提供 access_token ... 完全混乱......它的工作方式很愚蠢