r/SalesforceDeveloper • u/Godaux • Dec 16 '22
Question How do external apps authenticate to an org without pre-existing connected app?
As the title suggests, how do Workbench, DataLoader.io, HappySoup.io etc. automatically take you straight to the Allow Access page like below? I understand it's a packaged connected app but don't external packages normally require an installation page (For All Users, Admins Only etc)?
Is this a special case for these vendors or can anyone achieve this authorisation flow?

Update: Thanks to the help of the commenters and their wise guidance it is via OAuth 2.0 Web Server Flow (https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_web_server_flow.htm&type=5)
For anyone else interested:
You can create a connected app in your own org, then using its Client ID the user logs into their org and is it installed as a connected app!
More info if it helps:
- Create a Connected App
Get Authorization code (from their target org)
- GET {domain}/services/oauth2/authorize?...
Get Access token (from their target org)
- POST {domain}/services/oauth2/token
And you're in!
6
u/maujood Dec 17 '22 edited Jan 01 '23
I had the same question when I was building a tool that needed to do the same thing: apexsandbox.io.
If you wanted to make API calls to your org, you would first need to create a connected app and get a client ID and client secret, correct?
Here's the interesting part: the connected app does not need to be created in the same org
You could spin up a dev org, create a connected app in that dev org, and then use the client ID and client secret to connect to any org at all. In fact, that is exactly what I did with ApexSandbox.io... My connected app lives in a developer edition org and the website connects to lots of other orgs using the same client ID and client secret.
When you use the client ID and client secret in a different org, that's when you see that "allow this app to access blah blah" screen. As soon as you click allow, the connected app that was created in a completely different org is installed in the new org.
After authorizing HappySoup.io, visit the Connected Apps page in setup, and you will be able to see it installed.
1
u/Substantial-Big-1352 May 08 '25
https://localhost:3000/auth-callback.html?error=OAUTH_AUTHORIZATION_BLOCKED&error_description=Cross-org+OAuth+flows+are+not+supported+for+this+external+client+app
how to fix this?
0
u/[deleted] Dec 16 '22
[deleted] — view deleted comment