Skip to content

Fix token object support in tokenStore (fixes #143)#145

Merged
levz0r merged 1 commit into
masterfrom
fix/issue-143-object-token-support
Dec 4, 2025
Merged

Fix token object support in tokenStore (fixes #143)#145
levz0r merged 1 commit into
masterfrom
fix/issue-143-object-token-support

Conversation

@levz0r
Copy link
Copy Markdown
Owner

@levz0r levz0r commented Dec 4, 2025

Summary

  • Fixes tokenStore.get() to return token object as-is when passed an object instead of a path
  • Fixes tokenStore.store() to skip filesystem write when token_path is an object
  • Adds tests to verify object token handling

Fixes #143

Problem

The refresh_access_token() function documents support for both token file paths and token objects:

/**
 * @param {string | Object} token - Path to token json file or token Object.
 */

However, tokenStore.get() and tokenStore.store() unconditionally assumed token was a file path, causing runtime errors when using in-memory token objects (e.g., from environment variables).

Test plan

  • Added failing tests that prove the bug exists
  • Fixed token-store.js to handle object tokens
  • All 9 tests pass locally (npm test)
  • CI tests pass

🤖 Generated with Claude Code

The refresh_access_token() function documents support for both token
file paths and token objects, but tokenStore.get() and tokenStore.store()
assumed token was always a path, causing failures with in-memory tokens.

Changes:
- get(): Return token object as-is when passed an object
- store(): Skip filesystem write when token_path is an object
- Add tests to verify object token handling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@levz0r levz0r merged commit 5f3932b into master Dec 4, 2025
2 checks passed
@levz0r levz0r deleted the fix/issue-143-object-token-support branch December 4, 2025 15:12
This was referenced Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refresh_access_token() and tokenStore assume token is a path, despite documented object support

1 participant