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
Sushrutha KSushrutha K 

Cross Domain issue while accessing SalesForce API using AngularJS

We are facing cross domain issues while accesing SalesForce APIs using AngularJS.

When we try to access the token API, we are getting "200 OK" as status, but we will not be able to read the response because "access-control-allow-origin" header is not present in the SF server response. This issue is happening only while fetching the access token api.

Only If a browser that supports CORS makes a request to an origin in the Salesforce CORS whitelist, Salesforce returns the origin in the "Access-Control-Allow-Origin" HTTP header, along with any additional CORS HTTP headers. If the origin is not included in the whitelist, Salesforce returns HTTP status code 403.

We found an alternative to this by accessing the api by calling a PHP file from AngularJS and fetching the api data using cURL.

Is this a good approach or is there any other alternative with direct method?
NagendraNagendra (Salesforce Developers) 
Hi Sushrutha,

May I suggest you please check with below link from stack exchange community. Please let us know if you need anything else.

Regards,
Nagendra.
JLA.ovhJLA.ovh
It depends on which API your are calling. Some are CORS compatible (REST api, Chatter API...), some are not (Soap API, LiveAgent API...)
Sushrutha KSushrutha K
Hi Nagendra,
Thanks for the suggestion. We'll try implementing this and let you know.

Warm Regards
Sushrutha
Sushrutha KSushrutha K
@adminbooster.com,
We are stuck with this issue during OAuth. As I mentioned earlier, this issue is happening only while fetching the access token api.
Sushrutha KSushrutha K
We can avoid CORS issue using JSONP method, But here the problem is, oauth token API doesn't support JSON and it suuports only x-www-form-urlencoded. So we can not use the JSONP method for outh token API. Is there any other work around so that we can call the oth token API from Angularjs and avoid the CORS issue?
patricia wildpatricia wild
The security of your building or establishment can never be taken for granted, so it is essential to have access control systems installed (http://dicsan.com/home/accesscontrol/). These control systems are used in businesses and other public buildings to prevent unwanted guests, workers, or just plain visitors from getting inside unauthorized. There are many options available when it comes to door access systems. So you should make sure you get one that meets the security requirements of your business. There are basically two types of door access systems, namely Intrusion alarm systems and Fire alarm systems. Intrusion alarm systems are used primarily for external doors. In contrast, Fire alarm systems are mainly used for internal doors within a building or establishment.