oroinc / platform

Main OroPlatform package with core functionality.
Other
627 stars 351 forks source link

User email synchronization of Gmail account through OAuth2 doesn't work #1016

Open Riwaz opened 4 years ago

Riwaz commented 4 years ago

Summary
There are some problems when I try to synchronize my Gmail emails to crm-application in version 4.1.2. Previously we used version 3.1.15 where it worked fine.

  1. First error was: Header name must be an RFC 7230 compatible string. This problem I resolved with changing the $headers array of strings in Oro\Bundle\ImapBundle\Manager\ImapEmailGoogleOauth2Manager.php:192 to an associative array ['Content-Type' => 'application/x-www-form-urlencoded', ...]
  2. After resolving the first error there was another: In Oro\Bundle\ImapBundle\Manager\ConnectionControllerManager.php:168 the $userInfo variable is HWI\Bundle\OAuthBundle\OAuth\ResponsePathUserResponse and this class doesn't contain getResponse() method. So I removed the condition and just returned the $response so it would work atleast somehow.
  3. After resolving the second error the request to /gmail/connection/access-token was successful which made me hopeful but the next request to /imap/connection/account/change ended with an exception: Block "widget_container_attributes" on template "OroImapBundle:Form:accountTypeGmail.html.twig" does not exist.

After this error I stopped trying to fix the Gmail synchronization. Because I didn't know if you would like me to do an pull request. For example if you already knew about this issue and someone is already working on a fix (I tried to find an issue in tracker but I wasn't succesful).

Steps to reproduce

  1. Configure Google integration (secret key, ...) and enable OAuth 2.0 for email sync.
  2. Go to user's email configuration and in Email synchronization settings select Account type Gmail.
  3. Log in to Google through their modal.
  4. After login error's will appear / request will end with 500.

Details about your environment

anyt commented 4 years ago

Internal ticket id #CRM-9158.