turbot / steampipe-plugin-salesforce

Use SQL to instantly query Salesforce resources. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/salesforce
Apache License 2.0
9 stars 6 forks source link

Make a Connected App optional to authenticate to Salesforce, and client_id optional in the salesforce.spc #15

Closed d416 closed 1 year ago

d416 commented 1 year ago

Is your feature request related to a problem? Please describe. Salesforce allows logging in with only a username and password, if the org is configured that way. Similar to a token, a Connected App is not required to authenticate.

Describe the solution you'd like Make client_id in the salesforce.spc optional. If it does not exist, use only the credentials that are there, which is username/password, or token if it exists. Username and Password are the minimum required to authenticate.

Describe alternatives you've considered Setting up a Connected App is cumbersome and may not be available to a non-admin user. User in Salesforce can be enabled with API access by an administrator, so those Users who are comfortable using SQL could use this plugin, however not if a Connected App is required.

Additional context Many SF devs and power users authenticate to the REST API using their own credentials. This is useful for casual querying, or testing as other users. Using a Connected App is best practice for formal integration uses, however for all other uses including casual querying this is unnecessary overhead.

cbruno10 commented 1 year ago

Hey @d416 , do you get an error if you don't specify the client_id config arg today?

From our code, I can see we default to steampipe today: https://github.com/turbot/steampipe-plugin-salesforce/blob/main/salesforce/utils.go#L33-L38

And in the simpleforce SDK we use, it seems they have an example using a default client ID of https://github.com/simpleforce/simpleforce/blob/acf4ac67ef68eee62febf8e1afac93b55b0e6512/force.go#L21, so I'm not sure how impactful specifying the client_id is.

d416 commented 1 year ago

Yes it would appear that client_id is optional - I just tried omitting this and it worked!
From the docs this looked mandatory so it threw me. Thanks for the clarification!

Note: the simpleforce docs say you can define client_id = "whatever" to keep track of your app, but this doesn't actually appear in the auth logs in Salesforce, so whether this is defined or omitted in the plugin config has no consequence on authentication or tracking, it will use just the ID/Password combination.