Integrating with Salesforce

Hey Fellow Bubblers,
Salesforce is that one app that I can’t wrap around and don’t really understand fully.

Context: I’m trying to integrate my app with Salesforce. It’s a multi-tenant app with multiple organizations. Some organizations have the ability to integrate my app with their Salesforce instance.

I want to integrate by having whoever from the org is setting up the integration to login with Salesforce to grant access for me to write and read from/to their Salesforce instance.

Here’s my thought process: I’m thinking I might need to use OAuth 2.0 Web Server Flow? But can’t really figure it out. How do I get a Connected App? From my understanding, a connected app needs to be configured per Salesforce instance.

Any tips on where to start?

Thanks!

Also important to note I’m doing something different than this past thread I opened working with only one specific Salesforce instance with the username + password of the Salesforce account.

Will you use API Connector or do manual configuration?
user-agent flow is probably easier to implement

API Connector

I don’t understand where you get the client_id from, is it from a connected app I create in my developer’s salesforce instance?

Yes. client ID and client secret should be provided with the app you have created in SF dev console.

I’m looking here and it seems to only ask for client id?

I’m assuming it’s this?

I’m then getting this error:

Doing this, is a manual process. The authorize url is a GET request and is made using a simple link (link element or Open an external url.
The token request will be made in API Connector

Oh I think I know what you mean. The problem is that I still can’t generate the correct link:

I’m doing:

https://login.salesforce.com/services/oauth2/authorize?response_type=token&client_id=3MVG91oqviqJKoEFFsEHiHzzE1._RAyZ2N_08OBv9p99fCLqHDEbpk4sqTKs2VFLjBjQ7jiOg2_XX1fzjuIVe&redirect_uri=[Redirect URL]

I think my client id is wrong? Is the above screenshot not where I get it from?

But I’m pretty sure that’s right:

Your url is response type token. I was thinking you was looking for webserver flow? I checked the doc and finally, it will work too . More standard authorization_code process :wink:

Oooh I was looking at User-Agent Flow because I thought you said it’s easier to implement :sweat_smile:

haha yes sorry!

https://MyDomainName.my.salesforce.com/services/oauth2/authorize?
client_id=3MVG9IHf89I1t8hrvswazsWedXWY0i1qK20PSFaInvUgLFB6vrcb9bbWFTSIHpO8G2jxBLJA6uZGyPFC5Aejq&
redirect_uri=https://www.mycustomerorderstatus.com/oauth2/callback&
response_type=code

replace your client_id with the one from dev and the correct url

lol no worries I tried doing

https://login.salesforce.com/services/oauth2/authorize? client_id=3MVG9IHf89I1t8hrvswazsWedXWY0i1qK20PSFaInvUgLFB6vrcb9bbWFTSIHpO8G2jxBLJA6uZGyPFC5Aejq& redirect_uri=https://www.mycustomerorderstatus.com/oauth2/callback& response_type=code and it’s not working

I’m assuming I can’t just do login.salesforce.com and have to collect the org’s salesforce domain?

Login salesforce will work for all instance.
You will collect this info from the token endpoint (that you will initialize in API Connector). This will be used in future call. But for auth, it’s not needed

1 Like

Hmm now I’m getting: .../error=invalid_request&error_description=missing+required+code+challenge at my redirected URL any ideas? It doesn’t even bring me to the sign into SF screen :sweat_smile:

Do you have the full url? Sound strange because what doc say is that pkce is not mandatory

1 Like

Yep: https://login.salesforce.com/services/oauth2/authorize?client_id=3MVG91oqviqJKoEFFsEHiHzzE1_DB44PnACp3bZwIrPI9CIIfIJje6mo1HSMfgXxYG0LFt08BIbIdwyGCMLL.&redirect_uri=https://volunteerfusion.bubbleapps.io/version-test/salesforce_callback&response_type=code

Oh I know… lol

I had Require Proof Key for Code Exchange (PKCE) Extension for Supported Authorization Flows enabled

1 Like

Issue is probably in your settings in Connected app. I don’t have access to a SF account actually, but you need to turn off something for PKCE

1 Like

Omg FINALLY thank you so much @Jici was banging my head over this one for a couple of hours lol

1 Like

Next step is to get the token in API connector using the code :wink: Forget everything related to pkce (provide minimal information for the token endpoint)

1 Like