Exemple #1
0
        public async Task <IActionResult> Task1()
        {
            HttpContext.Response.Cookies.Append(_currentPageCookieName, "1");

            // #TODO: Assign your secret token provided by the original email on the variable below
            var secretToken = "";

            // You must assign a valid secretToken above!
            if (string.IsNullOrEmpty(secretToken))
            {
                return(View());
            }

            // Retrieve the API key from the mole in form of JSON string.
            var jsonResponse = await _terminalService.RetrieveApiKey(secretToken);

            // #TODO: The API Key from the response seems to return empty value. You will need to debug and find out why.
            var viewModel = JsonConvert.DeserializeObject <Task1GetApiKeyResponse>(jsonResponse);

            return(View("Task1", viewModel.ApiKey));
        }