Skip to content

Fix OAuth credentials and gzip response handling#9

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

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

@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.
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

Comments