Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can this be true that if we use Salesforce OAuth to grant login to a desktop app, then after validating and receiving tokens -> access, refresh etc) if client workstation switches Internet Connections i.e switching from a LAN to Wireless (different ISPs) it will throw errors when accessing data via those tokens?

share|improve this question

There is nothing OAuth specific, however there are salesforce features that related to networks, e.g. if "Lock sessions to the IP address from which they originated" is turned on, and you used your refresh token to get an access token while on the LAN, that access token is not going to work when you change ISPs.

Also, using the token endpoint to get a new access token is subject to the users profile IP range restrictions, and also login time windows.

share|improve this answer
Yes from Salesforce perspective of OAuth, I've further refined the error situation to might be occurring due to Trusted IP Range entered in user's Salesforce Instance under Setup -> Security Controls -> Network Access. Do you or anyone know how can we determine if User has been restricted due to Network Access settings of Trusted IP Range via API in .Net? – VarunC Jan 22 '13 at 16:08
@superfell Thanks for the explanation.Loved It! – Mohith Shrivastava Jan 22 '13 at 16:16
@vc4u Check out the Metadata API. You can read lockSessionsToIp in the org's SessionSettings and ipRanges in the org and user profile. You can access the Metadata API from .Net via its WSDL. – metadaddy Jan 22 '13 at 17:01
@superfell thanks for the reply. I checked and I found "Lock sessions to the IP address from which they originated" as unchecked. So, by theory, access_token should not cause any trouble even if the ISP is changed at client workstation? The troubling part for me has been that I could test run the same settings perfectly fine at my workstation. I tried checking if Session time out could have caused the SOAP exception when calling SOQL query via api but that also didn't caused the trouble since I fetch new access_token if session has expired using refresh_token. – VarunC Jan 23 '13 at 8:16

The OAuth 2.0 Authorization Framework

The OAuth 2.0 Authorization Framework: Bearer Token Usage

The OAuth access token is just passed as a bearer token in the HTTP request and hence there is no reason this should throw errors. Yes, if the time period of the access token has expired then the error may occur and then we can always use the refresh token to again obtain the access token.

share|improve this answer
@metadaddy .thanks for removing the glitches and making the answer look much better. – Mohith Shrivastava Jan 22 '13 at 16:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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