Beispiel #1
0
    public async Task <string> GetToken()
    {
        this.App = ConfidentialClientApplicationBuilder.Create(this.ClientID)
                   .WithClientSecret(this.ClientSecret)
                   .WithAuthority(new Uri(this.Authority))
                   .Build();

        this.ResourceIds = new string[] { this.ResourceID };
        this.Result      = await App.AcquireTokenForClient(this.ResourceIds).ExecuteAsync();

        this.AzureADAccessToken = this.Result.AccessToken;
        return(this.AzureADAccessToken);
    }