public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
    {
        if (actionContext.Request.RequestUri.AbsolutePath.Contains("api/auth"))
        {
            return;
        }

        var authManager = new AuthCacheManager();

        var user = authManager.CurrentUser;

        if (user == null)
        {
            throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }

        //Updates the authentication
        authManager.Authenticate(user.SocialUser);
    }
    public TokenIdentity Post(
        SocialNetwork socialNetwork,
        string socialUserID,
        [FromUri] string socialAuthToken,
        [FromUri] string deviceRegistrationID = null,
        [FromUri] DeviceType?deviceType       = null)
    {
        var socialManager = new SocialManager();

        var user = socialManager.GetSocialUser(socialNetwork, socialUserID, socialAuthToken);

        var tokenIdentity = new AuthCacheManager()
                            .Authenticate(
            user,
            deviceType,
            deviceRegistrationID);

        return(tokenIdentity);
    }