diff --git a/Source/ProofOfConcept/Program.cs b/Source/ProofOfConcept/Program.cs index 461521a..4a672be 100644 --- a/Source/ProofOfConcept/Program.cs +++ b/Source/ProofOfConcept/Program.cs @@ -254,8 +254,6 @@ if (app.Environment.IsDevelopment()) string[] vins = vehiclesEnvelope?.Response.Select(x => x.Vin ?? "").Where(v => !String.IsNullOrWhiteSpace(v)).ToArray() ?? Array.Empty(); logger.LogCritical("User has access to {count} cars: {vins}", vins.Length, String.Join(", ", vins)); - if (vins.Length == 0) - return Results.Ok("No cars found"); //Get CA from validate server file string fileContent = await File.ReadAllTextAsync("Resources/validate_server.json"); @@ -281,6 +279,9 @@ if (app.Environment.IsDevelopment()) }; logger.LogInformation("Config request: {configRequest}", JsonSerializer.Serialize(configRequest, new JsonSerializerOptions() { WriteIndented = true })); + if (vins.Length == 0) + return Results.Ok("No cars found"); + client.BaseAddress = new Uri("https://fleet-api.prd.eu.vn.cloud.tesla.com"); client.DefaultRequestHeaders.Add("Authorization", $"Bearer {access_token}"); client.DefaultRequestHeaders.Add("X-Tesla-User-Agent", "Tesla-Connector/1.0.0");