By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
horizontal-light horizontal-dark
  • Home
  • Tutorials
    • Salesforce Flow
    • Salesforce Integration
    • Salesforce Tools
    • Apex Development
    • Lightning Web Components
  • Salesforce AI
  • Salesforce DevOps
  • Career
  • Interview Questions
  • Errors
  • About
    • Privacy Policy
    • Disclaimer
    • Terms & Conditions
    • Contact
SalesforceCornerSalesforceCorner
Search
  • Home
  • Tutorials
    • Salesforce Flow
    • Salesforce Integration
    • Salesforce Tools
    • Apex Development
    • Lightning Web Components
  • Salesforce AI
  • Salesforce DevOps
  • Career
  • Interview Questions
  • Errors
  • About
    • Privacy Policy
    • Disclaimer
    • Terms & Conditions
    • Contact
Follow US
Salesforce Corner » Salesforce Integration » How to Set Up a Connected App in Salesforce for API Integration
Salesforce Integration

How to Set Up a Connected App in Salesforce for API Integration

Learn how to securely connect external applications with Salesforce using Connected Apps, OAuth 2.0, and API integration.

Neha Panwar
By
Neha Panwar
ByNeha Panwar
Salesforce Developer and Technical Writer
Neha Panwar is a Salesforce developer and technical writer who shares practical tutorials, Apex guides, and real-world solutions for developers. She focuses on simplifying Salesforce concepts,...
Follow:
- Salesforce Developer and Technical Writer
Last updated: 2026/06/21
Share
Salesforce connected app setup page (1)
SHARE

A REST API request fails with an authentication error. Postman returns an invalid client response. An external application cannot access Salesforce data even though the API endpoint is correct. In most cases, the problem isn’t the API itself. The missing piece is usually a properly configured Connected App.

When an external application needs access to Salesforce, Salesforce must know who is requesting access and what permissions should be granted. Simply knowing the username and password isn’t enough. Salesforce uses OAuth 2.0 authentication, and Connected Apps act as the bridge between Salesforce and external systems.

Whether you’re integrating Salesforce with Postman, a custom web application, MuleSoft, mobile applications, or third-party platforms, creating a Connected App is usually the first step. Without it, generating access tokens and securely calling Salesforce APIs becomes impossible.

In this guide, you’ll learn how to set up a Connected App in Salesforce for API Integration, understand how OAuth authentication works, and configure everything required for secure communication between Salesforce and external applications.

Contents
What Is a Connected App in Salesforce?Why Is a Connected App Required for API Integration?How Connected App Authentication WorksCommon Use Cases for Connected AppsBefore You Create a Connected AppStep 1: Open App ManagerStep 2: Configure Basic InformationConnected App NameAPI NameContact EmailStep 3: Enable OAuth SettingsCallback URLSelecting OAuth ScopesStep 4: Save the Connected AppStep 5: Configure OAuth PoliciesUnderstanding the Consumer Key and Consumer SecretConsumer KeyConsumer SecretStep 6: Generate an Access TokenTesting the Connected App Using PostmanMethodURLBody ParametersReal Project ExampleCommon Connected App ErrorsSecurity Best PracticesConnected App vs Named CredentialWhen Should You Create a Connected App?Frequently Asked QuestionsWhat is a Connected App in Salesforce?Why do I need a Connected App for API integration?What is the Consumer Key?What is the Consumer Secret?Can I use Postman with a Connected App?Which OAuth scopes should I select?What happens if the callback URL is incorrect?Is a Connected App required for REST API access?Can multiple applications use one Connected App?How long does Connected App activation take?ConclusionRead More

What Is a Connected App in Salesforce?

A Connected App is a framework that allows external applications to securely communicate with Salesforce using standard authentication protocols such as OAuth 2.0, OpenID Connect, and SAML.

Think of a Connected App as a trusted gateway between Salesforce and another application.

For example, if a web application wants to read Account records from Salesforce through the REST API, Salesforce first needs to verify the application’s identity. The Connected App provides that identity and controls what level of access the application receives.

Without a Connected App:

  • Access tokens cannot be generated
  • OAuth authentication cannot occur
  • External applications cannot securely access Salesforce APIs

This is why Connected Apps are considered a core component of Salesforce integrations.

Organizations implementing Salesforce REST API Tutorial for Beginners with Real Integration Examples concepts often create a Connected App before making their first API request because OAuth authentication depends on it.

Why Is a Connected App Required for API Integration?

Many beginners assume Salesforce APIs can be accessed directly using a username and password. While some legacy approaches exist, modern integrations rely heavily on OAuth 2.0 because it is more secure and scalable.

A Connected App provides:

  • Authentication
  • Authorization
  • Access token generation
  • Permission control
  • API security

Consider a common business scenario.

A company has a custom customer portal where users can view Salesforce data without logging directly into Salesforce. The portal needs access to Account records, Contacts, and Cases.

Instead of sharing Salesforce credentials, the application authenticates through a Connected App and receives an access token.

The access token then allows the application to securely interact with Salesforce APIs.

This approach is safer and aligns with Salesforce security best practices.

How Connected App Authentication Works

Before creating a Connected App, it’s helpful to understand the authentication flow.

External Application
          ↓
Connected App
          ↓
OAuth 2.0 Authentication
          ↓
Consumer Key Validation
          ↓
Access Token Generated
          ↓
Salesforce REST API
          ↓
Salesforce Data

The process begins when an external application sends an authentication request.

Salesforce validates the Connected App configuration and OAuth settings. If everything is configured correctly, Salesforce generates an access token. The application then uses that token when making API requests.

Understanding this flow makes troubleshooting much easier later.

Common Use Cases for Connected Apps

Connected Apps are used in a wide variety of Salesforce integration projects.

One of the most common examples is Postman testing. Developers frequently create a Connected App so they can generate access tokens and test REST API endpoints before building a production integration.

Another common use case involves middleware platforms such as MuleSoft. These tools require OAuth authentication to communicate securely with Salesforce.

Mobile applications also depend heavily on Connected Apps because users need a secure way to access Salesforce data from their devices.

Similarly, custom web applications often use Connected Apps to authenticate users and retrieve Salesforce records through APIs.

If you’ve already explored Types of Salesforce Integrations: Complete Guide for Beginners, you’ll notice that many integration architectures eventually rely on a Connected App for authentication.

Before You Create a Connected App

Before starting the setup process, verify the following:

  • Salesforce administrator access
  • API Enabled permission
  • Access to Salesforce Setup
  • A callback URL
  • Basic understanding of OAuth

Although a callback URL may sound complicated, it is simply the location where Salesforce sends authentication responses after login.

For testing purposes, many developers initially use:

https://login.salesforce.com/services/oauth2/success

Later, this can be replaced with the actual URL used by the application.

Step 1: Open App Manager

Log in to Salesforce and open Setup.

Inside the Quick Find box, search for:

App Manager

Then select App Manager from the Setup menu.

App Manager contains all Salesforce applications, Connected Apps, and Lightning applications.

From this screen, click:

New Connected App

This launches the Connected App configuration wizard.

Step 2: Configure Basic Information

The first section contains general application details.

Complete the following fields:

Connected App Name

My API Integration App

API Name

This field is generated automatically.

Example:

My_API_Integration_App

Contact Email

Enter an email address that Salesforce can use for notifications.

Example:

[email protected]

You can also upload a logo and provide a description, although these settings are optional.

At this stage, Salesforce simply creates the application record. API authentication settings are configured in the next step.

Step 3: Enable OAuth Settings

This is the most important section of the entire configuration.

Locate:

Enable OAuth Settings

and check the box.

Once enabled, Salesforce displays additional OAuth configuration options.

Callback URL

Enter the application’s redirect URL.

Example:

https://login.salesforce.com/services/oauth2/success

For production integrations, use the actual application callback URL.

The callback URL must match exactly what the application sends during authentication.

Even a small mismatch can cause OAuth authentication failures.

Selecting OAuth Scopes

OAuth scopes determine what the external application is allowed to do.

For most API integrations, Salesforce administrators commonly select:

Access and manage your data (api)

and

Perform requests on your behalf at any time
(refresh_token, offline_access)

The API scope allows external applications to access Salesforce APIs.

The refresh token scope allows applications to generate new access tokens without requiring users to log in repeatedly.

Choosing the correct OAuth scopes is important because they directly affect application permissions.

In the next section, we’ll configure policies, retrieve the Consumer Key and Consumer Secret, generate access tokens, and test the Connected App using Postman.

Step 4: Save the Connected App

After configuring the basic information and OAuth settings, click Save.

Salesforce doesn’t make the Connected App available immediately. In most orgs, it can take a few minutes for the configuration to become active. Many developers think something is broken because they cannot find the Consumer Key right away. However, this delay is completely normal.

Once the setup is complete, Salesforce displays a confirmation page containing the Connected App details.

At this point, the application exists, but we still need to configure security policies and retrieve the credentials required for authentication.

Step 5: Configure OAuth Policies

After saving the Connected App, open it from App Manager and click:

Manage Consumer Details

or

Manage Connected Apps

depending on your Salesforce version.

Next, open:

Edit Policies

OAuth policies control who can use the application and how authentication behaves.

One commonly used setting is:

Permitted Users

For many enterprise integrations, administrators select:

Admin approved users are pre-authorized

This provides better control because administrators decide exactly who can access the application.

Organizations implementing Salesforce Integration Best Practices: Complete Guide for Scalable Systems often prefer this option because it reduces security risks associated with unrestricted access.

Understanding the Consumer Key and Consumer Secret

Every Connected App generates two important values:

Consumer Key

Acts like a public identifier for the application.

Consumer Secret

Acts like a password for the application.

To view them:

Setup
      ↓
App Manager
      ↓
Connected App
      ↓
Manage Consumer Details

You’ll see:

Consumer Key
Consumer Secret

These values are required whenever an external application requests an access token.

Never expose the Consumer Secret publicly. Anyone with access to both values may be able to authenticate against Salesforce if additional security controls are not in place.

Salesforce connected app setup page

Step 6: Generate an Access Token

After creating the Connected App, the next step is authentication.

The external application sends:

  • Client ID (Consumer Key)
  • Client Secret (Consumer Secret)
  • Username
  • Password
  • OAuth parameters

Salesforce validates the request and returns an access token.

The access token is then included in future API requests.

A simplified flow looks like this:

Application
      ↓
Consumer Key
Consumer Secret
      ↓
Salesforce OAuth Endpoint
      ↓
Access Token Returned
      ↓
REST API Request
      ↓
Salesforce Data

Without a valid access token, Salesforce rejects API requests.

This is why Connected Apps are the foundation of secure API integrations.

Testing the Connected App Using Postman

One of the easiest ways to verify your configuration is by using Postman.

Developers commonly use Postman before building a production integration because it allows API requests to be tested quickly.

Configure:

Method

POST

URL

https://login.salesforce.com/services/oauth2/token

Body Parameters

grant_type=password
client_id=Consumer Key
client_secret=Consumer Secret
username=Your Username
password=Your Password + Security Token

After sending the request, Salesforce returns:

{
  "access_token":"xxxxxxxx",
  "instance_url":"https://yourorg.my.salesforce.com"
}

If you successfully receive an access token, the Connected App is working correctly.

This testing approach pairs well with the concepts covered in Salesforce REST API Tutorial for Beginners with Real Integration Examples, where access tokens are used to retrieve Salesforce data.

Real Project Example

I first configured a Connected App while integrating a customer portal with Salesforce. The portal needed to display Account and Contact information without requiring users to log directly into Salesforce.

Initially, every API request failed because OAuth authentication had not been configured. After creating a Connected App, enabling OAuth settings, and generating an access token, the integration started working immediately. The biggest lesson from that project was how critical OAuth scopes and callback URLs are. A single configuration mistake can prevent the entire integration from working.

Common Connected App Errors

Connected Apps are usually straightforward to configure, but several common mistakes appear repeatedly.

ErrorCauseSolution
invalid_client_idIncorrect Consumer KeyVerify Consumer Key
invalid_grantUsername or password issueCheck credentials
redirect_uri_mismatchCallback URL mismatchUpdate callback URL
insufficient_scopeMissing OAuth scopeAdd required scopes
invalid_clientIncorrect Consumer SecretVerify secret value
access deniedUser not authorizedReview Connected App policies

Most OAuth problems are configuration issues rather than Salesforce platform issues.

Security Best Practices

Connected Apps provide access to Salesforce data, so security should always be a priority.

Only grant the OAuth scopes that are actually required. Excessive permissions increase risk without providing additional value.

Store Consumer Secrets securely and never include them in client-side code repositories.

Use dedicated integration users whenever possible. This makes auditing and troubleshooting easier because API activity is separated from normal user activity.

Additionally, review Connected App usage regularly and remove unused applications.

Organizations building large-scale integrations often combine Connected Apps with Named Credentials vs Remote Site Settings in Salesforce to simplify authentication management and improve security.

Connected App vs Named Credential

Many beginners confuse these two features because both are related to integrations.

FeatureConnected AppNamed Credential
PurposeOAuth AuthenticationManage External Authentication
Used ByExternal ApplicationsSalesforce Callouts
Generates Consumer KeyYesNo
Generates Access TokensYesNo
Integration DirectionInto SalesforceFrom Salesforce

A simple way to remember this:

Connected Apps help external systems access Salesforce.

Named Credentials help Salesforce access external systems.

When Should You Create a Connected App?

You typically need a Connected App when:

  • Building REST API integrations
  • Connecting Salesforce with Postman
  • Creating mobile applications
  • Authenticating third-party systems
  • Using OAuth 2.0 authentication
  • Integrating middleware platforms

If an external application needs secure access to Salesforce data, a Connected App is usually part of the solution.

Frequently Asked Questions

What is a Connected App in Salesforce?

A Connected App allows external applications to securely access Salesforce using OAuth authentication and APIs.

Why do I need a Connected App for API integration?

Because Salesforce requires OAuth authentication before external applications can access APIs.

What is the Consumer Key?

The Consumer Key is the application’s public identifier used during OAuth authentication.

What is the Consumer Secret?

The Consumer Secret acts like a password for the application and is used during token generation.

Can I use Postman with a Connected App?

Yes. Postman is one of the most common tools used to test Connected Apps and Salesforce APIs.

Which OAuth scopes should I select?

Most API integrations require API access and refresh token permissions.

What happens if the callback URL is incorrect?

OAuth authentication will fail and Salesforce may return a redirect URI mismatch error.

Is a Connected App required for REST API access?

In most modern OAuth-based integrations, yes.

Can multiple applications use one Connected App?

Yes, although many organizations prefer separate Connected Apps for different integrations.

How long does Connected App activation take?

It usually becomes available within a few minutes after saving.

Conclusion

Understanding How to Set Up a Connected App in Salesforce for API Integration is essential for anyone working with Salesforce integrations. A Connected App acts as the foundation of OAuth authentication, allowing external applications to securely communicate with Salesforce APIs.

By configuring OAuth settings correctly, selecting appropriate scopes, securing Consumer Keys and Secrets, and testing authentication with tools like Postman, you can build reliable and secure integrations. Whether you’re connecting a web application, mobile app, middleware platform, or API testing tool, a properly configured Connected App is often the first step toward a successful Salesforce integration.

Read More

  • VS Code Setup for Salesforce Development
  • Types of Salesforce Integrations: Complete Guide for Beginners
  • Salesforce Integration Best Practices: Complete Guide for Scalable Systems
  • Salesforce Inspector Reloaded Guide: Features, Use Cases, and Real Examples
TAGGED:Connected App SetupConsumer KeyConsumer SecretOAuth 2.0Salesforce API IntegrationSalesforce Connected AppSalesforce IntegrationSalesforce REST API
Share This Article
Facebook Email Print
ByNeha Panwar
Salesforce Developer and Technical Writer
Follow:
Neha Panwar is a Salesforce developer and technical writer who shares practical tutorials, Apex guides, and real-world solutions for developers. She focuses on simplifying Salesforce concepts, integrations, and backend development to help beginners and professionals learn faster.
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Latest Post

How to use DLRS in Salesforce
How to Use DLRS in Salesforce for Lookup Roll-Up Summaries
Salesforce Admin
Salesforce data migration guide for admins
Salesforce Data Migration: A Step-by-Step Guide for Admins
Uncategorized
Greenfield vs Brownfield Salesforce comparison
Greenfield vs Brownfield Salesforce Implementations: Differences
Salesforce Tutorials
Salesforce technical debt analysis in a Salesforce org
Salesforce Technical Debt: What It Is and How to Reduce It
Salesforce Admin
Salesforce security model workflow (1)
Permission Set Groups in Salesforce: When and How to Use Them
Salesforce Admin

Stay Updated with Salesforce Tutorials

Get the latest Salesforce guides, tutorials, and developer tips delivered to your inbox.
slaesforce corner mascot

Explore More Topics

  • salesforce admin
  • salesforce developer
  • Salesforce Admin
  • Salesforce Development
  • Lightning Web Components
  • salesforce security
  • lightning web components
  • salesforce tutorial
  • Salesforce Tutorials
  • salesforce lwc
  • Salesforce Tools
  • salesforce apex
  • salesforce automation
  • lwc tutorial
  • Salesforce Beginner Guide
horizontal-dark-transparent

Learn Salesforce development with practical tutorials, Apex guides, integration examples, and real-world solutions for developers.

  • Quick Links:
  • About
  • Contact
  • Privacy Policy
  • Disclaimer
  • Terms & Conditions
Facebook Twitter Youtube Linkedin-in

Salesforce Corner © 2026

Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?