1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-16 16:23:41 +00:00

null checks

This commit is contained in:
Kyle Spearrin
2017-11-30 15:50:05 -05:00
parent 835c9f9cac
commit 28c0509886
2 changed files with 3 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ namespace Bit.Core.Services
}
var encBytes = SettingsService.Instance.AccessToken;
if(encBytes != null)
if(encBytes?.Value != null)
{
_accessToken = Encoding.ASCII.GetString(encBytes.Decrypt());
}

View File

@@ -18,8 +18,8 @@ namespace Bit.Core.Utilities
var authContext = new AuthenticationContext(
$"https://login.windows.net/{SettingsService.Instance.Server.Azure.Tenant}/oauth2/token");
var creds = new ClientCredential(SettingsService.Instance.Server.Azure.Id,
SettingsService.Instance.Server.Azure.Secret.DecryptToString());
var secret = SettingsService.Instance.Server.Azure.Secret.DecryptToString();
var creds = new ClientCredential(SettingsService.Instance.Server.Azure.Id, secret);
var authResult = await authContext.AcquireTokenAsync("https://graph.microsoft.com/", creds);
request.Headers.Add("Authorization", $"Bearer {authResult.AccessToken}");
}