public async Task <IActionResult> Login([FromBody] Login.Request req)
        {
            var requester = new AuthenticationServer.ProtocolModels.Auth.Login();

            requester.request.account  = req.account;
            requester.request.password = req.password;

            var response = await requester.PostAsync(AuthenticationServerInfo.Uri);

            if (response == null)
            {
                return(BuildErrorResponse("SeverInternalError"));
            }

            if (response.resultCode == AuthenticationServer.ProtocolModels.Auth.Login.Response.ResultCode.Ng)
            {
                return(BuildErrorResponse("NgAuth"));
            }

            var toolAccount = new KvsModels.ToolAccount(response.account);

            toolAccount.Model.signingKey   = evolib.Util.KeyGen.Get(32);
            toolAccount.Model.lastAuthDate = DateTime.UtcNow;
            await toolAccount.SaveAsync();

            var payload = new EvoToolJwt.Payload();

            payload.accountId = response.account;
            var token = EvoToolJwt.Build(payload, toolAccount.Model.signingKey);

            return(Ok(new Login.Response
            {
                token = token,
            }));
        }
        public async Task <IActionResult> Login([FromBody] Login.Request req)
        {
            var accountType        = evolib.Account.Type.Unknown;
            var account            = "";
            var hostType           = evolib.HostType.Unknown;
            var accountAccessToken = "";
            var countryCode        = "";


            if (req.password == SystemInfo.BattleServerPassword)
            {
                account  = "ba8b168a-71f2-4fd4-82e3-e427b5714899";
                hostType = HostType.BattleServer;
            }
            else if (req.accountType == evolib.Account.Type.Inky)
            {
                {                // POST login
                    var requester = new evolib.Multiplatform.Inky.Login1();
                    requester.request.temporary_token = req.authToken;
                    var response = await requester.PostAsync(req.authToken);

                    if (response.StatusCode == System.Net.HttpStatusCode.OK && response.Payload.status == "success")
                    {
                        accountAccessToken = response.Payload.data.access_token;
                    }
                    else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
                    {
                        return(BuildErrorResponse(Error.LowCode.NgAuth));
                    }
                    else
                    {
                        return(BuildErrorResponse(Error.LowCode.ServerInternalError));
                    }
                }
                {                // GET accounts/me
                    var requester = new evolib.Multiplatform.Inky.AccountsMe();
                    var response  = await requester.GetAsync(accountAccessToken);

                    if (response.StatusCode == System.Net.HttpStatusCode.OK && response.Payload.status == "success")
                    {
                        account     = response.Payload.data.uid.ToString();
                        countryCode = response.Payload.data.country_code;
                    }
                    else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
                    {
                        return(BuildErrorResponse(Error.LowCode.NgAuth));
                    }
                    else
                    {
                        return(BuildErrorResponse(Error.LowCode.ServerInternalError));
                    }
                }

                accountType = req.accountType;
                hostType    = evolib.HostType.Player;
            }
#if DEBUG
            else if (System.Text.RegularExpressions.Regex.IsMatch(req.account, @"^LoadTester([0-9]|[1-9][0-9]{1,5})@BNO$"))
            {
                await Task.Delay(500);

                account     = req.account;
                hostType    = HostType.Player;
                accountType = evolib.Account.Type.LoadTest;
                countryCode = "JP";
            }
            else
            {
                var requester = new AuthenticationServer.ProtocolModels.Auth.Login();
                requester.request.account  = req.account;
                requester.request.password = req.password;

                var response = await requester.PostAsyncXXX(AuthenticationServerInfo.Uri);

                if (response.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    return(BuildErrorResponse(Error.LowCode.ServerInternalError));
                }

                if (response.Payload.resultCode == AuthenticationServer.ProtocolModels.Auth.Login.Response.ResultCode.Ng)
                {
                    return(BuildErrorResponse(Error.LowCode.NgAuth));
                }

                account     = response.Payload.account;
                hostType    = response.Payload.hostType;
                accountType = evolib.Account.Type.Dev1;
                countryCode = "JP";
            }