public async Task <IActionResult> GithubLogin([FromBody] OAuthLoginData data) { var tokenInfo = await githubService.GetAccessTokenAsync(data.Code).ConfigureAwait(false); if (string.IsNullOrEmpty(tokenInfo.Error)) { var githubUserInfo = await githubService.GetUserInfoAsync(tokenInfo.AccessToken).ConfigureAwait(false); var githubUser = oAuthService.GetGithubUser(githubUserInfo.Id); if (githubUser == null) { var githubRegistrationData = new GithubRegistrationData { GithubToken = tokenInfo.AccessToken }; githubUser = await registrationService.RegisterViaGithub(githubRegistrationData, githubUserInfo); } var loginResponse = authenticationService.GithubOAuthLogin(githubUser, tokenInfo.AccessToken); if (loginResponse.Success) { return(Ok(loginResponse)); } } return(BadRequest()); }