Closed ritec closed 8 years ago
Here is my omnicontacts config.
Rails.application.middleware.use OmniContacts::Builder do importer :gmail, "XXXXXXXX.apps.googleusercontent.com", "XXXXXXX", redirect_uri={:redirect_path => "/invites/gmail/contact_callback", :max_results => 10000} #, :ssl_ca_file => "/etc/ssl/certs/curl-ca-bundle.crt"} end
These are the subsequent requests that happen after my original successful requests when issuing POST ajax requests from the /invites/gmail/contact_callback?code=XXXXXXX page
Started POST "/businesses/88/invites" for XXXXXXXXX at 2015-10-22 15:59:41 -0400 Processing by Businesses::InvitesController#create as JS Parameters: {"utf8"=>"✓", "authenticity_token"=>"XXXXXXXXXXXXXXX", "business_id"=>"88"}
Rendered businesses/invites/create.js.erb (0.5ms) Completed 200 OK in 45.9ms (Views: 15.4ms | ActiveRecord: 2.6ms) Error internal_error while processing /invites/gmail/contact_callback: { "error" : "invalid_grant", "error_description" : "Code was already redeemed." }
Started GET "/invites/gmail/contact_callback?code=XXXXXXXXXXXXXXXXXXXXXXXXXX" for XXXXXXXXX at 2015-10-22 15:59:41 -0400
Started GET "/contacts/failure?error_message=internal_error&importer=gmail" for XXXXXXX at 2015-10-22 15:59:41 -0400 Processing by InvitesController#failure as */* Parameters: {"error_message"=>"internal_error", "importer"=>"gmail"} User Load (0.3ms) SELECT
users.* FROM
usersWHERE
users.
id= 565 LIMIT 1 Rendered text template (0.0ms) Completed 200 OK in 17.4ms (Views: 9.9ms | ActiveRecord: 0.3ms)
I have figured this issue out, the problem was related to another Get request being generated in one of my Javascript files. However it is still weird, and it probably should not have happened., I worked around it.
I have an issue in my development environment and I am not sure what is causing it, but it seems to be related to the behavior of the gem?
I am able to get all my gmail contacts by hitting
contacts/gmail
as per the gem instructions. Once I do that I print out all my contacts and have a button next to them to add to my application as a new contact using an Ajax request. The Ajax request works fine and the contact is saved in my application, however in my logs every time I press submit I get the following error:Completed 200 OK in 83.1ms (Views: 13.2ms | ActiveRecord: 19.9ms) Error internal_error while processing /invites/gmail/contact_callback: { "error" : "invalid_grant", "error_description" : "Code was already redeemed." }
Started GET "/invites/gmail/contact_callback?code=XXXXXXXXXXXXX" for 192.168.16.12 at 2015-10-21 16:49:35 -0400
Started GET "/contacts/failure?error_message=internal_error&importer=gmail" for 192.168.16.12 at 2015-10-21 16:49:36 -0400 Processing by InvitesController#failure as */* Parameters: {"error_message"=>"internal_error", "importer"=>"gmail"} User Load (0.3ms) SELECT
users.* FROM
usersWHERE
users.
id= 565 LIMIT 1 Rendered text template (0.0ms) Completed 200 OK in 22.3ms (Views: 3.2ms | ActiveRecord: 0.3ms)
Why is the gem trying to contact google again from the callback page?
These are my routes:
get "/invites/gmail/contact_callback" => "invites#contact_callback"
get "/contacts/failure" => "invites#failure"