Skip to content

Fix OAuth credentials and gzip response handling#9

Closed
stirman wants to merge 1 commit intosteipete:mainfrom
stirman:fix-oauth-and-gzip
Closed

Fix OAuth credentials and gzip response handling#9
stirman wants to merge 1 commit intosteipete:mainfrom
stirman:fix-oauth-and-gzip

Conversation

@stirman
Copy link
Copy Markdown

@stirman stirman commented Jan 28, 2026

Problem

  • authTokenEndpoint() hardcodes client_id: 'sleep-client' and client_secret: '' instead of using c.ClientID and c.ClientSecret
  • API responses are gzip-compressed but the client doesn't decompress them, causing JSON parse errors (invalid character '\x1f')

Fix

  1. Use the configured client credentials in token endpoint
  2. Check Content-Encoding: gzip header and decompress before JSON decode

Testing

Tested successfully with Eight Sleep Pod - status command now works.

1. authTokenEndpoint() was hardcoding 'sleep-client' and empty secret
   instead of using c.ClientID and c.ClientSecret from config/defaults.

2. API responses come gzip-compressed but weren't being decompressed,
   causing 'invalid character' JSON parse errors.
@omarshahine
Copy link
Copy Markdown
Collaborator

Thanks for identifying and fixing the OAuth credentials and gzip issues, @stirman! Your PR was one of the first to catch these bugs.

I've consolidated the fixes from multiple PRs into #24, which now covers OAuth form-encoding, gzip handling, bounded retries, and headless keyring support. Closing this in favor of that combined fix.

Appreciate the contribution — we'll get this released soon! 🙏

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.

2 participants