Fix OAuth token extraction from httr saved format#160
Merged
soodoku merged 1 commit intogojiplus:masterfrom Jan 14, 2026
Merged
Fix OAuth token extraction from httr saved format#160soodoku merged 1 commit intogojiplus:masterfrom
soodoku merged 1 commit intogojiplus:masterfrom
Conversation
httr's oauth2.0_token saves tokens as a list with a hash key, but yt_oauth was using the list directly instead of extracting the Token2.0 object. This caused "attempt to apply non-function" errors when making API calls with a loaded token. Now properly extracts token[[1]] when the saved object is a list wrapper rather than a Token object. Co-Authored-By: Claude Opus 4.5 <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
httr's
oauth2.0_tokensaves tokens as a list with a hash key, butyt_oauthwas using the list directly instead of extracting theToken2.0object. This caused "attempt to apply non-function" errors when making API calls with a previously saved token.The Problem
When a token is saved with
saveRDS()and later loaded, httr wraps it in a list structure:The existing code passed this list wrapper to
options(google_token = ...), but API calls expect the actual Token object.The Fix
Extract
token[[1]]when the loaded object is a list wrapper rather than a Token object:Test Plan
upload_video()and other API calls work with loaded tokens