[SalesForce] how to access a connected app from another org

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.

Best Answer

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.