Esempio n. 1
0
        public async Task <string> GetUserFromBearerToken(string token)
        {
            if (string.IsNullOrEmpty(token))
            {
                _logger.Log(LogLevel.Error, "gamesession", $"Missing bearer token when calling GetUserFromBearerToken()", new { });
                throw new ClientException("Missing required token parameter");
            }

            var data = await _service.DecodeBearerToken(token);

            if (string.IsNullOrEmpty(data?.userId))
            {
                _logger.Log(LogLevel.Error, "gamesession", $"Failed to retrieve userId from bearer token data", new { data });
            }
            return(data?.userId);
        }