简体   繁体   中英

How to resolve 'Cross Origin domain' issue without using 'CORS' chrome extension using Javascript to access JIRA REST API

I've developed an application to access JIRA REST API. By adding 'CORS' chrome extension, I'm able to get the data from http://localhost:8000 by enabling 'CORS'

But the application doesn't work without CORS extension. Can someone please let me know is there a way to access the REST API without 'CORS' extension.

For me it worked by doing following steps:

add a property in manifest.json

 "permissions": [ "activeTab", "tabs", "notifications", "http://*/", "https://*/" ] 

and try to request the rest API using jquery

  var settings = { "async": true, "crossDomain": true, "url": "your jira server URL", "method": "GET", "headers": { "authorization": "Basic <base64 username:password>", "cache-control": "no-cache" } } $.ajax(settings).done(function (response) { console.log(response); }); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM