airbytehq / airbyte

The leading data integration platform for ETL / ELT data pipelines from APIs, databases & files to data warehouses, data lakes & data lakehouses. Both self-hosted and Cloud-hosted.
https://airbyte.com
Other
16.05k stars 4.11k forks source link

[source-salesforce] support username/password authentication #44376

Open techieshark opened 2 months ago

techieshark commented 2 months ago

Connector Name

source-salesforce

Connector Version

2.5.27

What step the error happened?

Configuring a new connector

Relevant information

Compare the instructions for setting up a connection on the open source version: https://docs.airbyte.com/integrations/sources/salesforce#for-airbyte-open-source-obtain-salesforce-oauth-credentials

... with the same steps but for Airbyte Cloud - https://docs.airbyte.com/integrations/sources/salesforce#for-airbyte-cloud

Note that in the OSS version, one has to follow a fairly convoluted walkthrough blog post to obtain the 'refresh token'.

I'm wondering why that step is not necessary for Airbyte (commercial) Cloud? I'm also struggling to get the refresh token if the user is a Salesforce "api-only" user.

Expected result:

Relevant log output

No response

Contribute

girarda commented 2 months ago

@techieshark the reason for the difference is we can automatically obtain the refresh token through our Airbyte app on Cloud. We can't do this in OSS because the platform is self-hosted.

I'll rename the issue as a feature request for supporting user/password login because that is a good idea.

devfmartell commented 2 months ago

Could you also include authenticating with the client credentials as well? I think it could also be useful

techieshark commented 2 months ago

One other tip, for anyone who struggled with the instructions from the blog post mentioned above:

I was able to get the refresh token by using Postman, with this collection from Salesforce. On reflection, it's possible some source of my initial troubles were from logging in as an API-only user rather than simply my own (standard) user; not entirely sure if I've fixed this via the Postman route but at least I don't need to worry about mis-typing multiple URLs and commands.

To use Postman: Under Authorization tab and within the Configure New Token section, you set Grant Type to Authorization Code. Not sure it matters, but in my environment I've set {{url}} variable to be https://<someCompany>--<sandboxname>.sandbox.my.salesforce.com (for a sandbox environment), and {{site}} is just blank. {{clientId}} and {{clientSecret}} are the similar Oauth settings from the connected app (see details in the blog post for how to obtain).

See screenshots of what this looked like for me below:

image image image image

(Apologies for the screenshot jank/glitches, this is multiple screenshots atop each other.)