public UserBasicInfoModel GetLoggedInUserBasicInfo(HttpContext httpContext) { UserBasicInfoModel basicUserInfoModel = null; // Check User Basic Info in Token of Header var token = httpContext.Request.Headers[HeaderKey.Authorization].ToString(); if (!string.IsNullOrWhiteSpace(token)) { token = token.Replace(TokenType.AuthTokenType, string.Empty)?.Trim(); var isValid = JwtHelper.IsValid(token); var isExpire = JwtHelper.IsExpire(token); if (isValid && !isExpire) { basicUserInfoModel = JwtHelper.Get <UserBasicInfoModel>(token); } } else { // Check Logged User in Cookie AuthTrackingModel authTracking = CookieHelper.GetAuthTracking(httpContext, _dataProtectionProvider); var currentUserSignInTrackingModel = authTracking.Users.FirstOrDefault(x => x.IsLoggedIn && authTracking.CurrentUserId == x.Id); basicUserInfoModel = currentUserSignInTrackingModel?.MapTo <UserBasicInfoModel>(); } return(basicUserInfoModel); }