IdentityServer4 令牌端点
令牌端点主要后台编程方式获取令牌的端点,可以获取JWT令牌和reference令牌
这里只讨论JWT令牌,包含用户数据信息
POSTMAN方式:
编程方式:
var client = new HttpClient(); var disco = await client.GetDiscoveryDocumentAsync("服务器基地址"); if (disco.IsError) throw new Exception(disco.Error); var response = await client.RequestPasswordTokenAsync(new PasswordTokenRequest { Address = disco.TokenEndpoint, ClientId = "roclient", ClientSecret = "secret", UserName = "bob", Password = "bob",
//下面可选 Scope = "resource1.scope1 resource2.scope1", Parameters = { { "acr_values", "tenant:custom_account_store1 foo bar quux" } } }); if (response.IsError) throw new Exception(response.Error); return response;
需要引用: IdentityModel