Diego81 / omnicontacts

A generalized Rack middleware for importing contacts from major email providers.
477 stars 231 forks source link

Invalid grant, Code is already redeemed while fetching gmail contacts in production. #133

Open sumitsv21 opened 9 years ago

sumitsv21 commented 9 years ago

I got this unique problem where omnicontacts for gmail contacts fetching is working correctly in staging and development, but not in production. After much debugging, i found this internal error: Invalid grant Code is already redeemed

On seeing the production.log i m noticing that there are two get callback requests at the interval of 30s approx.

Started GET "/contacts/gmail" for ### at 2015-04-20 20:05:14 +0000

Started GET "/contacts/gmail/callback?code=4/5-ghyNx0qoiU8R-ZBoNCBLvc-93LG1dWcmmOf30KBWw.Use9bIzzg9QQcp7tdiljKKaHnN6wmQI" for ### at 2015-04-20 20:05:15 +0000 Started GET "/contacts/gmail/callback?code=4/5-ghyNx0qoiU8R-ZBoNCBLvc-93LG1dWcmmOf30KBWw.Use9bIzzg9QQcp7tdiljKKaHnN6wmQI" for ### at 2015-04-20 20:05:46 +0000

These two get callback requests are showing only in production and not in staging or development. It should be a single get callback.

Due to the timeout set for 30s, it is killing the worker and i am redirected to the failure path with the above error.

thomasgallagher commented 9 years ago

I've had a report of this too, did you manage to diagnose the issue? Not sure where to start as my Google account seems to connect and disconnect without a problem.

ritec commented 9 years ago

Did anyone figure this out? I am having a similar issue in development while working with the returned values with an ajax form. For some reason every time the submit button is pressed on my ajax form and I get a 200 OK back omnicontacts tries to reach gmail again?

Completed 200 OK in 27.2ms (Views: 6.8ms | ActiveRecord: 3.8ms) Error internal_error while processing /invites/gmail/contact_callback: { "error" : "invalid_grant", "error_description" : "Invalid code." }