Skip to content

Fix partner_login default scope for energy-only partners#29

Merged
Bre77 merged 1 commit intoTeslemetry:mainfrom
dc-morris:fix/partner-login-default-scope
Mar 23, 2026
Merged

Fix partner_login default scope for energy-only partners#29
Bre77 merged 1 commit intoTeslemetry:mainfrom
dc-morris:fix/partner-login-default-scope

Conversation

@dc-morris
Copy link
Copy Markdown
Contributor

Summary

  • Change the default scopes parameter in partner_login() from [Scope.VEHICLE_DEVICE_DATA] to [Scope.OPENID]

Problem

Partners who only have energy products (e.g. Powerwall) and no Tesla vehicles get an invalid_scope error when calling partner_login() without explicitly specifying scopes. This happens because vehicle_device_data is not granted to energy-only partner applications, so the token request is rejected by Tesla's auth server.

Fix

Since partner_login uses the client_credentials OAuth flow for partner-level authentication (not user-specific access), the default scope should not assume any particular product. openid is a universally available scope that works regardless of which product-specific scopes are granted to the partner application.

Partners who need specific scopes can still pass them explicitly via the scopes parameter.

…ce_data

The previous default scope of VEHICLE_DEVICE_DATA causes partner_login to
fail with invalid_scope for partners who only have energy products (e.g.
Powerwall) and no vehicle scopes granted. Since partner_login uses the
client_credentials flow for partner authentication rather than
user-specific access, OPENID is a more universal default that works
regardless of which product scopes are granted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Bre77
Copy link
Copy Markdown
Member

Bre77 commented Mar 23, 2026

The Partner Key endpoint requires a vehicle scope, so I'll need to figure out a way to opt-in and out of this, but will do that in a follow-up. https://developer.tesla.com/docs/fleet-api/endpoints/partner-endpoints#public-key

@Bre77 Bre77 merged commit a17f78f into Teslemetry:main Mar 23, 2026
@dc-morris dc-morris deleted the fix/partner-login-default-scope branch April 16, 2026 15:03
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