Correct JSON
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s

This commit is contained in:
2025-08-13 18:54:09 +02:00
parent 7efdcbaac5
commit 25f869851f
3 changed files with 33 additions and 11 deletions

View File

@@ -18,12 +18,20 @@ public class TeslaAuthenticatorService
const string authEndpointURL = "https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token";
const string euBaseURL = "https://fleet-api.prd.eu.vn.cloud.tesla.com";
private JsonSerializerOptions serializerOptions;
public TeslaAuthenticatorService(ILogger<TeslaAuthenticatorService> logger, IOptions<TeslaAuthenticatorServiceConfiguration> options, IHttpClientFactory httpClientFactory, IMemoryCache memoryCache)
{
this.logger = logger;
this.httpClientFactory = httpClientFactory;
this.memoryCache = memoryCache;
this.configuration = options.Value;
serializerOptions = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
};
}
/// Asynchronously retrieves an authentication token from the Tesla partner API.
@@ -39,7 +47,7 @@ public class TeslaAuthenticatorService
// URL to request the token
const string audience = euBaseURL;
// Prepare the form-urlencoded body
Dictionary<string, string> formData = new Dictionary<string, string>
{