[英]IdentityModel2 TokenClient Resource Owner Password
我正在嘗試使用IdentityModel2
獲得無記名令牌IdentityModel2
: //github.com/IdentityModel/IdentityModel2
他們的github頁面說它支持資源所有者密碼
但是我看不到添加用戶名/密碼的任何方法,也沒有關於如何執行此操作的示例。
如何使用TokenClient
獲得帶有用戶名和密碼的令牌?
答案很簡單,我只是錯過了正確的方法。 我將在此處添加而不是刪除,以防其他人偶然發現:
var client = new TokenClient(
_identityEndpoints.TokenEndpoint,
"client", "secret", AuthenticationStyle.PostValues);
var response = await client.RequestResourceOwnerPasswordAsync(user, pass, "scope");
var token = response.AccessToken;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.