Thinktecture ID 서버를 사용하여 angularjs 프론트 엔드가있는 웹 API를 보호하려고합니다. 다음 코드와 함께 API 서버를 통해 Identity Server에서 OAuth 토큰을 얻을 수 있습니다.웹 api에서 Thinktecture OAuth Token을 확인하십시오.
[HttpPost]
public async Task<JObject> LogOn(UserModel userModel)
{
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
var client = new OAuth2Client(
new Uri("https://identity.app.net/issue/oauth2/token"),
"dd",
"secret");
var result =
await
client.RequestResourceOwnerPasswordAsync(userModel.UserName, userModel.Password,
@"http://my.app.net/");
return result.Json ;
}
토큰을 반환합니다. 토큰이 요청의 헤더를 통과 할 때 [Authorize] 태그가 작동하는 방법을 알아낼 수 없습니다.
어떤 오류가 발생합니까? –