1

I am trying to use the databasedotcom gem to authenticate my application through Salesforce.com. The documentation is weak and I am new at OAuth. I have configured my app in Salesforce.com and have my secret and key. I am configuring from my environment:

client = Databasedotcom::Client.new(:client_id => ENV['SALESFORCE_CONSUMER_KEY'], :client_secret => ENV['SALESFORCE_CONSUMER_SECRET'])

Now I am supposed to get a token and use it to authenticate. How do I get a token? There are options for an externally accessed token and one obtained with a username and password, but I am unsure of what to do next or how I was supposed to get the token. The documents continue as if I have it already and should know where it came from.

jhamm
  • 24,124
  • 39
  • 105
  • 179

1 Answers1

1

If all you need is to access the REST API of SFDC.

you can do this:

client.authenticate :username => 'user@example.com', :password => '123'

and then:

users = client.materialize('User').all

for example the above will return all the users in the user's Org.

however...if you want follow the Oauth approach, and authenticate the databasedotcom gem using Oauth tokens, you can read more about oauth here: http://help.salesforce.com/help/doc/en/remoteaccess_oauth_web_server_flow.htm

i crafted my own oauth access flow using the above link (i used Net::HTTP class)