public async Task <IActionResult> NIDLogin([FromForm] NIDLoginDto dto)
        {
            _logger.LogInformation($"NID 登入: {dto.Status}, {dto.Message}, {dto.UserCode}");

            switch (dto.Status)
            {
            case 100:
                _logger.LogInformation("NID 登入: 使用者拒絕授權");
                return(Problem(title: "NID 登入失敗", detail: "使用者拒絕授權"));

            case 200:
                var nidUser = await _oAuthService.GetNIDUserInfoAsync(dto.UserCode);

                var user = await _oAuthService.HandleNIDLoginAsync(nidUser);

                if (!user.EmailConfirmed)
                {
                    return(Problem(title: "登入失敗", detail: "帳戶尚未驗證", statusCode: 403));
                }
                if (!user.IsEnable)
                {
                    return(Problem(title: "登入失敗", detail: "帳戶尚未啟用", statusCode: 403));
                }

                #region 添加角色聲明

                var claims = await _userManager.GetClaimsAsync(user);

                var roleNames = await _userManager.GetRolesAsync(user);

                foreach (var roleName in roleNames)
                {
                    var role = await _roleManager.FindByNameAsync(roleName);

                    var roleClaims = await _roleManager.GetClaimsAsync(role);

                    foreach (var roleClaim in roleClaims)
                    {
                        claims.Add(roleClaim);
                    }
                }

                #endregion

                var token = GenerateJwtToken(claims);
                var url   = $"{_configuration["FrontendUrl"]}/account/login/nid?token={token}";
                return(Redirect(url));

            case 300:
                _logger.LogInformation("NID 登入: 應用程式授權已到期");
                return(Problem(title: "NID 登入失敗", detail: "應用程式授權已到期", statusCode: 403));

            case 400:
                _logger.LogInformation("NID 登入: 欠缺必要的參數、有不正確的參數、有重複的參數、或其他原因導致無法解讀");
                return(Problem(title: "NID 登入失敗", detail: "欠缺必要的參數、有不正確的參數、有重複的參數、或其他原因導致無法解讀", statusCode: 403));

            case 500:
                _logger.LogInformation("NID 登入: 認證伺服器因為過載或維修中而暫時無法處理請求");
                return(Problem(title: "NID 登入失敗", detail: "認證伺服器因為過載或維修中而暫時無法處理請求", statusCode: 403));

            default:
                _logger.LogInformation("NID 登入: 發生例外況狀");
                return(Problem(title: "NID 登入失敗", detail: "發生例外況狀", statusCode: 403));
            }
        }