Skip to content

Conversation

@coleleavitt
Copy link

Summary

Fixes "Token refresh failed: 400" errors when using Claude Pro/Max OAuth authentication.

Problem

The Anthropic OAuth token endpoint (https://console.anthropic.com/v1/oauth/token) requires application/x-www-form-urlencoded content type, but the plugin was sending application/json.

This caused 400 Bad Request errors during:

  • Initial token exchange (exchange() function)
  • Token refresh (in the loader fetch wrapper)

Fix

Changed both OAuth token requests to use:

  • Content-Type: application/x-www-form-urlencoded
  • new URLSearchParams({...}) instead of JSON.stringify({...})

References

This aligns with:

Anthropic's OAuth token endpoint requires form-urlencoded data, not JSON.
This fixes 400 errors during token exchange and refresh operations.
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.

1 participant