TelemetryPublisherFirestore skip authorization on partial credentials

This commit is contained in:
Denis-Cosmin Nutiu 2020-11-23 19:59:13 +02:00
parent c86d851ffd
commit 527053642d

View file

@ -74,6 +74,11 @@ namespace NucuCar.Telemetry.Publishers
private async Task SetupAuthorization() private async Task SetupAuthorization()
{ {
// If there are no credentials or partial credentials supplies there must be no authorization.
if (_webApiKey == null || _webEmail == null || _webPassword == null)
{
return;
}
// Check if the token is about to expire in the next 5 minutes. // Check if the token is about to expire in the next 5 minutes.
if (DateTime.UtcNow.AddMinutes(5) < _nextExpiresTime) if (DateTime.UtcNow.AddMinutes(5) < _nextExpiresTime)
{ {