function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gwallimangwalliman 

Trying to Allocate OAUTH2 Token - Receive 400 Error on Locally Hosted Website

Our Salesforce instance has a REST API that is utilized by our .NET application - data is sent from the .NET app (hosted in Microsoft Azure) to the REST API and saved in Salesforce. As part of this communication, we retrieve tokens from the OAUTH2 service - the call to get the token is made, of course, from the .NET app.

Recently one of our .NET developers spun up the app in a locally hosted environment, and all of a sudden the OAUTH2 token call no longer works. He receives a "400 unknown_error" response when trying to call this service. We have tested the service call from Postman and it works; we have also inspected the outgoing call from the locally hosted .NET app and see absolutely no difference between this and the Postman call.

To recap: the call works from the Azure-hosted version of the app, and it works from the locally running Postman software; but the locally-hosted app gets a 400 error every time. As far as I can tell, the messages going out are exactly the same between the three scenarios.

Any thoughts on why this is and how we can fix it?

UC InnovationUC Innovation
It sounds like it may be due to a Callback URL issue.  In Salesforce, is the Connected App configured to handle the Callback URL of the new locally hosted environment?

​https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart_oauth.htm
gwallimangwalliman
Appreciate the response, we actually figured the problem out today. It seems that the locally hosted app was using TLS1.0 to make the call, which of course is currently blocked. We upgraded it to TLS1.1 and it works now.

 
UC InnovationUC Innovation
Glad you were able to figure this out.  I'll also file this into my memory bank.