mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-16 00:04:34 +00:00
null checks
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user