Hi,
When I get my token with scopes, method OnAuthorization doesnt receive the token with scopee, What am I doing wrong? :
public override void OnAuthorization(HttpActionContext actionContext)
{
base.OnAuthorization(actionContext);
ClaimsPrincipal principal = actionContext.ControllerContext.RequestContext.Principal as ClaimsPrincipal;
if (principal != null)
{
// If user does not have the scope claim, get out of here
if (principal.HasClaim(c => c.Type == "scope"))
{
// Split the scopes string into an array
var scopes = principal.Claims.FirstOrDefault(c => c.Type == "scope").Value.Split(' ');
// Succeed if the scope array contains the required scope
if (scopes.Any(s => s == scope))
return;
}
}
HandleUnauthorizedRequest(actionContext);
}