Ivica Nedeljkovic

Possible bug in SugarCRM Google API

Discussion created by Ivica Nedeljkovic on Aug 30, 2016
Latest reply on Sep 1, 2016 by Ivica Nedeljkovic

I am working on app that would need offline access to Google API, however, I noticed that when I authorized SugarCRM to access my Google Apps data, refresh token is not created in eapm table in api_data column, and I had to authorize app every 60 minutes. Error that I was get was: "Error: The OAuth 2.0 access token has expired, and a refresh token is not available. Refresh tokens are not returned for responses that were auto-approved."


After I debug code, in Google/Client.php file(lines 323-331) in comments it was said that "force" is default value, however in ExtAPIGoogle.php file, in function getGoogleClient() (lines 107-120) setApprovalPrompt is not called.


So after I added  on line 117:


after I authorized app again, refresh token was set in api_data column, and seems that everything is working correctly now.


In unit tests, these values are set correctly, so I just think this is bug that should be addressed in next release.
Any suggestions how I can fix this bug in upgrade friendly way, without modifying ExtAPIGoogle.php file?