2

I am trying to connect a Connected App with OAuth API settings I built in a Developer instance to an existing Enterprise Edition. Is this possible to do?

I was able without too much difficulty to connect my website to the API, then add contacts to my Developer instance. But then I asked a colleague who is a member of an Enterprise Edition instance to try it. He was able to retrieve an access token, but as soon as he tried to use it, he received an HTTP 401 error: [ { "message" : "Session expired or invalid", "errorCode" : "INVALID_SESSION_ID"} ]

So my two big questions at this point:

  1. Is it even possible to do? To connect a Connected App with OAuth API from a Developer instance to an existing Enterprise Edition.
  2. Does the Enterprise Edition need to authenticate our app somehow?
  • It may be that the Enterprise Edition user does not have API access. – metadaddy Jan 9 '14 at 4:29
4

A connected app is available to every instance of Salesforce once it is created. This is the entire purpose of a connected app. The user must grant access to the connected app just once, which will be remembered in the user's configuration. The user may choose to revoke this access at any time by logging out of the app (if configured to allow this), or by logging into Salesforce and revoking the access from their user detail page. The organization the user logs into does not need to be the same as the organization that hosts the connected app.

Connected apps can request a variety of "scopes." An access token must have the "api" scope in order to be used as a token for the REST or SOAP APIs, and must have the "web" scope in order to be used as a token for frontdoor.jsp (which logs them into salesforce.com through their browser). The most probable cause is that you did not include the API scope, which would cause this error to occur. Access tokens can be used for other purposes besides the API, such as obtaining user details ("id") or posting messages to Chatter ("chatter"). You should review your app's settings to make sure the appropriate scopes are selected.

  • Thank you very much for your response. That's what I thought the purpose of a connected app was as well, which is why I was surprised by the behavior. Though still confused. The scope of my app is everything but the chatter API. So the Selected OAuth scopes include: Access and manage your data (api) Access your basic information (id) Full access (full) Perform requests on your behalf at any time (refresh_token) Provide access to custom applications (visualforce) Provide access to your data via the Web (web) Any other ideas what might be keeping me from getting proper access? – chuckkre Jan 9 '14 at 16:12
  • 1
    If that's the case, there might be something wrong with your actual request. Maybe we should have a Salesforce Chat? I think this might be lengthy. – sfdcfox Jan 9 '14 at 16:21
  • FYI, I would really appreciate a chat (and I see you're in the room). Looks like I can't talk til I get 20 points! – chuckkre Jan 9 '14 at 16:31
  • @chuckkre Fair enough. If you can see my user profile details, try connecting with me on a Google Hangout. – sfdcfox Jan 9 '14 at 16:35
  • Figured it out, it WAS a problem with my request. I was using a fixed URL for all calls after I was authenticated instead of using the instance_url that's returned with the access token. Thanks for the help, turned out to be a much easier fix than what I was anticipating. – chuckkre Jan 9 '14 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.