Document VK API community-token photo-upload limitation; add Kate Mobile auth flow

VK's photos.getWallUploadServer only accepts user tokens — community tokens fail with error 27 ('Group authorization failed: method is unavailable with group auth') or error 15. The previous note hinted users could just enable the 'photos' right on a community token, which is wrong: the limitation is hard.

- Restore the accurate fallback warning (community token = photos as links)
- Add an explicit two-path help block: A) user token via Kate Mobile (app_id 2685278) implicit OAuth, with a prefilled authorize URL, B) community token for text-only

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
zuevav
2026-04-30 15:56:20 +03:00
parent 5d62158b1b
commit a0dd7b1ed4
2 changed files with 25 additions and 16 deletions
+1 -4
View File
@@ -292,10 +292,7 @@ class VKAPI
try {
$result = $this->wallPost($numericGroupId, $messageWithPhotos, []);
$firstError = $uploadErrors[0] ?? 'неизвестная ошибка';
$result['warning'] = 'Фото добавлены как ссылки — VK отказал в загрузке (' . $firstError . '). '
. 'Проверьте, что ключ сообщества создан с правом «Фотографии» и принадлежит ИМЕННО той группе, в которую вы постите. '
. 'Если используете пользовательский токен — у него должны быть права wall, photos, groups.';
$result['warning'] = 'Фото добавлены как ссылки. Метод photos.getWallUploadServer не работает с токеном сообщества (это ограничение VK API: error 27 «group auth» или error 15 «access denied»). Чтобы фото прикреплялись как вложения, нужен ПОЛЬЗОВАТЕЛЬСКИЙ access token с правами wall, photos, groups, offline.';
return $result;
} catch (Exception $e) {
throw new RuntimeException('Ошибка постинга: ' . $e->getMessage() . '. Также нет прав на загрузку фото.');