Using the Restforce Gem with SalesForce and Oauth 2.0 APIs

I am trying to use Restforce ( https://github.com/ejholmes/restforce ) to configure integration with my Rails application in the SalesForce API using Oauth 2.0.

Restforce describes the initialization process as follows:

Initialization

Which authentication method you use really depends on your use case. If you are creating an application in which many users from different organizations authenticate through oauth, and you need to interact with the data in their organization on their behalf, you should use the OAuth authentication token.

If you use a gem to interact with one organization (perhaps you built internal Salesforce integration?), Then you should use the username / password authentication method.

OAuth Token Authentication

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

Although the above will work, you probably want to use middleware (re) authentication, specifying the update token, client ID, and 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, and client_secretthe application, which was created in SF, but have no idea what other information I need to make to restforce.

Does anyone have experience with this stone? How can I use it to make an initial request token request in SF?

+4
1

Oauth 2.0, . Omniauth-Salesforce , , restforce.

omniauth , , .

.

+6

Source: https://habr.com/ru/post/1535280/


All Articles