AccidentalFish.ApplicationSupport.Azure.KeyVault.Implementation.KeyVault.GetAccessToken C# (CSharp) Метод

GetAccessToken() приватный Метод

private GetAccessToken ( string authority, string resource, string scope ) : Task
authority string
resource string
scope string
Результат Task
        private async Task<string> GetAccessToken(string authority, string resource, string scope)
        {
            var authContext = new AuthenticationContext(authority);
            ClientCredential clientCred = new ClientCredential(_clientId, _clientSecret);
            AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);

            if (result == null)
                throw new InvalidOperationException("Failed to obtain the JWT token");

            return result.AccessToken;
        }
    }