From a184e0146646e11f24a1444a28d5b2f9883fc489 Mon Sep 17 00:00:00 2001 From: Christian Wegerhoff Date: Mon, 25 Aug 2025 15:32:01 +0200 Subject: [PATCH] Add support for `vehicle_location` Fleet API scope Tesla recently started requiring the `vehicle_location` scope for the `/vehicle_data` endpoint. Without this scope, calls like `getAllData(vehicle)` fail with HTTP 403 (Forbidden). This PR adds `.vehicleLocation = "vehicle_location"` to the `TeslaAPI.Scope` enum so developers can request the proper scope when initializing the Fleet API client. --- Sources/TeslaSwift/TeslaSwift.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/TeslaSwift/TeslaSwift.swift b/Sources/TeslaSwift/TeslaSwift.swift index fb0af50..77c2989 100644 --- a/Sources/TeslaSwift/TeslaSwift.swift +++ b/Sources/TeslaSwift/TeslaSwift.swift @@ -43,12 +43,13 @@ public enum TeslaAPI { case offlineAccess = "offline_access" case userData = "user_data" case vehicleDeviceData = "vehicle_device_data" + case vehicleLocation = "vehicle_location" case vehicleCmds = "vehicle_cmds" case vehicleChargingCmds = "vehicle_charging_cmds" case energyDeviceData = "energy_device_data" case energyCmds = "energy_cmds" - public static var all: [Scope] = [.openId, .offlineAccess, .userData, .vehicleDeviceData, .vehicleCmds, .vehicleChargingCmds, .energyDeviceData, .energyCmds] + public static var all: [Scope] = [.openId, .offlineAccess, .userData, .vehicleDeviceData, .vehicleLocation, .vehicleCmds, .vehicleChargingCmds, .energyDeviceData, .energyCmds] } case ownerAPI