Example #1
0
        public async Task <IActionResult> ConnectMinecraftWithKey(string UUID, string key)
        {
            if (key == null || UUID == null)
            {
                return(NotFound("Please supply UUID and Key!"));
            }

            User user = await _userManager.FindByIdAsync(_connectionHandler.GetUserFromAPIKey(key));

            if (user == null)
            {
                return(NotFound(key));
            }

            user.minecraft_id = UUID;

            // Respond with new API key
            Guid guid = Guid.NewGuid();

            user.Api_Key = guid.ToString();

            await _userManager.UpdateAsync(user);

            return(Ok(user.Api_Key));
        }