Skip to content

fix(auth): tolerate current billing/info payload and improve auth JSON errors#4

Open
powerdot wants to merge 1 commit into
paperfoot:mainfrom
powerdot:main
Open

fix(auth): tolerate current billing/info payload and improve auth JSON errors#4
powerdot wants to merge 1 commit into
paperfoot:mainfrom
powerdot:main

Conversation

@powerdot
Copy link
Copy Markdown

This fixes two issues that block suno auth --login against the current Suno web API:

  1. billing/info now returns a payload shape that no longer guarantees fields like plan, total_credits_left, period, etc.
    The CLI was treating those as required, so auth appeared to fail even though the Clerk exchange had already succeeded.

  2. Clerk auth failures were being surfaced as a generic error decoding response body, which made it hard to distinguish a real auth problem from API schema drift.

This patch:

  • makes BillingInfo, Plan, and Model more tolerant to missing fields
  • falls back from total_credits_left to credits when needed
  • synthesizes a minimal plan when Suno omits it
  • captures raw response text before JSON parsing for Clerk and billing paths
  • turns opaque decode failures into actionable API errors with a response excerpt
  • clears stale Clerk session state when --jwt is used directly

Verification

Verified locally against the current live Suno web API:

  • suno auth --login succeeds
  • suno credits --json succeeds

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