I'm attempting to use Thinktecture identity server to secure a web api with an angularjs front end. I'm able to get an OAuth token from Identity Server via the api controller with the following code:
[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 ;
}
This returns a token. I cannot seem to figure out how to get the [Authorize] tag to work when the token if passed in the header of the request.