var httpClient = new HttpClient(); var disco = httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest { Address = "http://localhost:5000", Policy = { RequireHttps=false } }).Result; if (disco.IsError) { throw new Exception(disco.Error); } var tokenResponse = httpClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest { Address = disco.TokenEndpoint, ClientId = "aa", ClientSecret = "bb", Scope = "cc" }); string token = tokenResponse.Result.AccessToken; Console.Write(token);