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);

 

相关文章:

  • 2021-12-10
  • 2022-01-16
  • 2021-07-04
  • 2021-08-09
  • 2021-11-26
  • 2021-06-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
相关资源
相似解决方案