ruby on rails - Using Restforce gem with SalesForce API and Oauth 2.0 -


i'm trying use restforce (https://github.com/ejholmes/restforce) set integration rails app salesforce's api using oauth 2.0.

restforce describes initialization process follows:

initialization

which authentication method use depends on use case. if you're building application many users different orgs authenticated through oauth , need interact data in org on behalf, should use oauth token authentication method.

if you're using gem interact single org (maybe you're building salesforce integration internally?) should use username/password authentication method.

oauth token authentication

client = restforce.new :oauth_token => 'oauth token',   :instance_url  => 'instance url' 

although above work, you'll want take advantage of (re)authentication middleware specifying refresh token, client id , client secret:

client = restforce.new :oauth_token => 'oauth token',   :refresh_token => 'refresh token',   :instance_url  => 'instance url',   :client_id     => 'client_id',   :client_secret => 'client_secret' 

i have client_id , client_secret app created in sf, have no idea other information need putting restforce.

does have experience gem? how use make original request token request sf?

you need login using oauth 2.0 first, provide tokens gem. did using omniauth-salesforce , after tokens handed instatiate restforce.

the examples in omniauth using sinatra, please this repo implementation using rails.

i've blogged well.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -