public async Task <IActionResult> ParseToken(string code) { var accessToken = await _vkHelper.GetAccessToken(code); var profiles = await _vkHelper.GetAdProfiles(accessToken); var vm = _mapper.Map <VkAdProfilesViewModel>(profiles); return(Content("")); }
public async Task <IActionResult> VkAd([FromQuery] string code) { var accessToken = Request.HttpContext.Session.GetString("vkAccessToken"); if (string.IsNullOrWhiteSpace(accessToken)) { if (string.IsNullOrWhiteSpace(code)) { return(Redirect( "https://oauth.vk.com/authorize?client_id=7012170&display=page&redirect_uri=https://localhost:44326/VkAd&scope=98304&response_type=code&v=5.95")); } accessToken = await _vkHelper.GetAccessToken(code); Request.HttpContext.Session.SetString("vkAccessToken", accessToken); } var profiles = await _vkHelper.GetAdProfiles(accessToken); var vm = _mapper.Map <VkAdProfilesViewModel>(profiles); return(View(vm)); }