public async Task <IActionResult> GetBlizzardToken([FromQuery] string code, [FromQuery] string redirectUri) { var token = await _authenticationService.GetToken(code, redirectUri); if (token == null) { return(Unauthorized("Sorry H4ckerb0i")); } var userInfo = await _registrationHandler.GetUserOrRegister(token.access_token); if (userInfo == null) { return(Unauthorized("Sorry H4ckerb0i")); } var w3User = await _w3CAuthenticationService.GetUserById(userInfo.battletag); if (w3User == null) { var w3CUserAuthentication = W3CUserAuthentication.Create(userInfo.battletag); await _w3CAuthenticationService.Save(w3CUserAuthentication); return(Ok(w3CUserAuthentication)); } return(Ok(w3User)); }
public Task Save(W3CUserAuthentication user) { return(Upsert(user)); }