Skip to content

Commit

Permalink
prefer the EU endpoint from the token regardless of ou_code. Proxy no…
Browse files Browse the repository at this point in the history
…w only supports EU accounts, not NA
  • Loading branch information
jbanyer committed May 28, 2024
1 parent 0d9d955 commit e98cec9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ func (p *oauthPayload) domain() string {
}

if inet.ValidTeslaDomainSuffix(d) && strings.HasPrefix(d, "fleet-api.") {
// PATCHED by jbanyer. Only return the EU endpoint. This means the proxy will not work with NA accounts.
if strings.HasSuffix(d, "eu.vn.cloud.tesla.com") {
return d
}
domain = d

// Prefer domains that contain the ou_code (region)
if strings.Contains(domain, ouCodeMatch) {
return domain
Expand Down

0 comments on commit e98cec9

Please sign in to comment.