Fix partner_login default scope for energy-only partners#29
Merged
Bre77 merged 1 commit intoTeslemetry:mainfrom Mar 23, 2026
Merged
Conversation
…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
approved these changes
Mar 23, 2026
Member
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scopesparameter inpartner_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_scopeerror when callingpartner_login()without explicitly specifying scopes. This happens becausevehicle_device_datais not granted to energy-only partner applications, so the token request is rejected by Tesla's auth server.Fix
Since
partner_loginuses theclient_credentialsOAuth flow for partner-level authentication (not user-specific access), the default scope should not assume any particular product.openidis 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
scopesparameter.