Fix invalid access_token (4) error on acceptAllFriendRequests#31
Open
Fix invalid access_token (4) error on acceptAllFriendRequests#31
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: undefined
This commit fixes issue #18 by adding support for the "invalid access_token (4)" error that occurs when calling acceptAllFriendRequests. The execute.sh script now detects this error and automatically refreshes the access token using the same mechanism used for expired tokens and IP address changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
User authorization failed: invalid access_token (4). on acceptAllFriendRequestsThis reverts commit f419c23.
konard
added a commit
that referenced
this pull request
Oct 17, 2025
When VK API returns error 1116 ("Anonymous token is invalid"), the script
now automatically acquires a new access token using the same mechanism
that handles other token-related errors (expired, IP mismatch, missing).
This fix handles the case when VK API treats a user token as anonymous
and rejects it, which can occur when:
- The token format is not recognized properly by VK servers
- There's a mismatch in token validation on VK's side
- The token authentication state has changed
The solution follows the same pattern as PR #31 for handling invalid
access_token errors by detecting the specific error message and
triggering automatic token refresh.
Fixes #16
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #18 by adding automatic token refresh when the VK API returns an "invalid access_token (4)" error.
Changes
execute.shto detect and handle the "invalid access_token (4)" error messageProblem
The
acceptAllFriendRequestsfunction was failing with the error:The
execute.shscript already handled several token-related errors (expired tokens, IP address changes, and missing tokens), but did not handle the specific "invalid access_token (4)" error.Solution
Added the invalid access_token error to the list of errors that trigger automatic token refresh. This allows the script to recover gracefully when encountering this error, maintaining the same behavior as other token-related issues.
Fixes #18
🤖 Generated with Claude Code