public override async Task <RequestResult <AuthorizationData> > Handle(AuthorizeUserWithGoogleCommand request, CancellationToken cancellationToken) { var tokenInfo = await _googleApiClient.GetTokenInfoAsync(request.Token); var(hasError, result) = await ValidateTokenWithProviderSettings(tokenInfo, request.RequestContext.Tenant); if (hasError) { return(result); } if (await _authRepository.GoogleUserExists(tokenInfo.ExternalUserId, request.RequestContext.Tenant.TenantId)) { return(await UpdateExistingUser(tokenInfo, request.RequestContext.Tenant)); } if (await _authRepository.IsEmailRegisteredForTenant(tokenInfo.Email, request.RequestContext.Tenant.TenantId)) { return(await AddGoogleToExistingUser(tokenInfo, request.RequestContext.Tenant)); } return(await CreateNewGoogleUser(tokenInfo, request.RequestContext.Tenant)); }