Esempio n. 1
0
        public async Task <ApiResult> Logout([FromQuery] BasicInput basicInput, [FromQuery] string token)
        {
            if (token.IsNullOrEmpty())
            {
                return(Result(DefaultStatusCode.Success));
            }

            var principal = await _jwtTokenService.ValidateTokenAsync(JwtTokenType.AccessToken, token);

            var userIdStr  = principal.Claims.FirstOrDefault(d => d.Type.Equals("UserId", StringComparison.InvariantCultureIgnoreCase))?.Value;
            var clientType = basicInput.ClientType.ToString();

            await _jwtTokenService.DeleteTokenAsync(userIdStr, clientType);

            return(Result(DefaultStatusCode.Success));
        }