Skip to content

Commit

Permalink
make Token public, so token expiry can be checked.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescoverdale committed May 8, 2024
1 parent 697df6e commit 63237a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PolestarSharp/PolestarApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class PolestarApi
private const string POLESTAR_API_URL = $"{POLESTAR_BASE_URL}/my-star";

private readonly HttpClient _httpClient;
private Token _token;
public Token Token;

public PolestarApi(string username, string password, string vin)
{
Expand All @@ -37,7 +37,7 @@ public async Task<bool> Login()
try
{
var apitoken = await GetAccessToken();
_token = apitoken;
Token = apitoken;
return true;
}
catch (Exception e)
Expand Down Expand Up @@ -138,7 +138,7 @@ private async Task<T> SendQuery<T>(string url, string query, string operationNam

if (useAuth)
{
request.Headers.TryAddWithoutValidation("Authorization", $"Bearer {_token.access_token}");
request.Headers.TryAddWithoutValidation("Authorization", $"Bearer {Token.access_token}");
}

var response = await _httpClient.SendAsync(request);
Expand Down

0 comments on commit 63237a3

Please sign in to comment.