I have created one connected app with API (Enable OAuth Settings) and it has generated consumer key and consumer secret. how to use this information to access the connected app from a different org? Here i'm not using any java or client application to make a request using consumer key and consumer secret to the access this app. please advise.

1 Answer 1


A connected app is much like an "app" on Facebook. The actual app exists elsewhere, but authenticates with Facebook to retrieve database information (e.g. your friends, date of birth, and email).

Simply direct the user to the authentication service (such as https://login.salesforce.com/services/oauth2/authorize) with your connected app details, and the user will be prompted to login. On successful login, they may need to authorize the app ("grant"), at which point, salesforce.com will redirect the user back to the app with an access token the app can use to leverage the API, plus some user information (like the URL to use for API calls).

Depending on if you're using the Web Service flow or User-Agent flow, your process may be slightly different. One gives you a token that you have to "cash in" for a real access token, while the other immediately provides an access token. The Web Service flow uses the client secret as an extra password (more protection), versus the User-Agent flow (for untrusted environments).

The connected app does not need to exist in the other org before the first use, but if it doesn't, an administrator needs to be the first one to use the application so they can grant access to the app. This allows administrators to review what information is accessible to the app, and configure who can use the app.

  • thanks @SFDCFOX .. i have used this format to form the link to access the app created : login.salesforce.com/services/oauth2/…>.. final link: login.salesforce.com/services/oauth2/… &redirect_uri=localhost and that redirects me successfully to the app allow- deny page but then on clicking allow throws error : Connection refused Description: Connection refused
    – user59759
    Mar 30, 2015 at 12:36
  • @sfdcfox having a button (in vf page) "Login with salesforce" in an org, which lets the user login with another Salesforce org credentials to get the data, is this possible? I know another options like setting identity/service provider, salesforce-to-salesforce, streaming api ways, rest services etc! Feb 25, 2020 at 15:49
  • @AdityaVijay Using a Named Credential, you could probably do this, although I would advise considering the use of Environment Hub, which is purpose-built to allow this type of functionality.
    – sfdcfox
    Feb 25, 2020 at 16:20
  • @sfdcfox the 2 orgs I took the example of are not related, I need login with Salesforce feature (like the complete Oauth flow) where web app is another org only! possible? Feb 26, 2020 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .