URL方式

发现端点可通过/.well-known/openid-configuration相对于基址使用

如: https://demo.identityserver.io/.well-known/openid-configuration 

编程方式

        static IDiscoveryCache _cache = new DiscoveryCache("服务器基地址");

            var disco = await _cache.GetAsync();
            if (disco.IsError) throw new Exception(disco.Error);

            var client = new HttpClient();
      //这里举例密码获取token
var response = await client.RequestPasswordTokenAsync(new PasswordTokenRequest { Address = disco.TokenEndpoint, ClientId = "roclient.reference", ClientSecret = "secret", UserName = "bob", Password = "bob", Scope = "scope4.scope" }); if (response.IsError) throw new Exception(response.Error); return response;

需要引用: IdentityModel 

 

相关文章:

  • 2021-07-19
  • 2022-01-08
猜你喜欢
  • 2022-03-06
  • 2021-09-25
  • 2021-08-13
  • 2021-12-11
  • 2022-12-23
  • 2021-08-01
相关资源
相似解决方案