Search code examples
ruby-on-rails-3databasedotcom-gem

using multiple access tokens with databasedotcom gem


After having googled enough (and failing!) I thought of posting this question here. (Interestingly SO shows all matching questions before you start posting yours based on subject you use for your question. But no help :(

Anyways my situation is:

  1. authorize the rails app by logging to different Orgs and save the access_token (AT), refresh_token(RT) and instance_url(IU) received back.List item
  2. authenticate the databasedotcom (DBDC) gem client using different AT,RT & IU based on which user I want to access data for.

BUT.

After first authenticate using DBDC gem, if I try to authenticate using different AT,RT & IU for a different user and access data I still get data of the first authenticated user!

I tried looking in the code of DBDC gem, but maybe I am not really experienced enough, so I could not find any solution/traceback for this issue I am facing.

Any help/link/pointer on this will be highly appreciated!

PS: interestingly enough, there seems to be a concept of logout form oauth session. Did not see it mentioned anywhere in docs, still struggling though.


Solution

  • Heyy! I did nothing (that I know) to fix it, and I am successfully able to switch between different Orgs using different access tokens (previously received using OAuth)!

    R e l i e f !

    PS: I did try to use cURL (assuming that maybe DBDC was storing the old token and reusing), but all of a sudden when I tried after having success with cURL, it worked with DBDC as well.