public IActionResult Index()
        {
            var googleState    = SetNewSessionState(_googleSessionSettings.StateKey);
            var redirectUri    = ApiUri.GetGoogleRedirectUri(HttpContext);
            var googleLoginUrl = _googleService.GetLoginUrl(googleState, redirectUri);

            var githubState    = SetNewSessionState(_githubSessionSettings.StateKey);
            var githubOAuthUrl = _githubService.GetOAuthCodeUrl(githubState);

            var viewModel = new IndexViewModel
            {
                GoogleLoginUrl = googleLoginUrl,
                GithubOAuthUrl = githubOAuthUrl
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> AuthReturn(
            [FromQuery] string code,
            [FromQuery] string state)
        {
            var stateFromCookie = HttpContext.Session.GetString(_googleSessionSettings.StateKey);

            if (stateFromCookie != state)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var redirectUri = ApiUri.GetGoogleRedirectUri(HttpContext);
            var tokens      = await _googleService.GetTokensFromApi(code, redirectUri);

            HttpContext.Session.SetString(_googleSessionSettings.AccessTokenKey, tokens.AccessToken);
            HttpContext.Session.SetString(_googleSessionSettings.IdTokenKey, tokens.IdToken);

            return(RedirectToAction("Profile"));
        }