public async Task <IActionResult> CallbackAsync(string state, string code) { _logger.LogInformation($"Process oAuth authorisation response and generate tokens."); try { _logger.LogInformation($"Exchanging token...code = {code} state = {state}"); await _oAuthService.ExchangeAuthCodeForAuthToken(code); } catch (Exception ex) { _logger.LogError($"{ex.Message}, {ex.StackTrace}"); var result = JsonConvert.SerializeObject(ex); return(Content(result)); } return(new RedirectResult(state)); }