<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CORS Error while fetching access token from HMRC in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/cors-error-while-fetching-access-token-from-hmrc/m-p/12117462#M1973992</link>
    <description>&lt;P&gt;I am trying to fetch access token from HMRC Sandbox API. The below code works completely fine when I test it from my web IDE. But it doesn't work as the same in the client's system. The only difference in code is the redirect URI in the client system which is also a HTTPS link. I cannot disable web security or add CORS plugin. Is there any other way to fix this issue?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;var postQuery ={};
postQuery.code = that.code;
postQuery.client_id = that.getView().getModel("appView").getProperty("/clientID");
postQuery.client_secret = that.getView().getModel("appView").getProperty("/clientSecret");
postQuery.grant_type ="authorization_code";
postQuery.redirect_uri ="https://webidetesting4631275-p*******trial.dispatcher.hanatrial.ondemand.com/webapp/index.html?hc_orionpath=/DI_webide_di_workspaceletjq4u76joab5p6/Run_Reports";
$.post("https://test-api.service.hmrc.gov.uk/oauth/token", postQuery,function(data){
  console.log(data);});&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;&amp;lt;img src="https://answers.sap.com/storage/temp/1731534-error.png"&amp;gt;&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Sep 2019 08:05:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2019-09-16T08:05:34Z</dc:date>
    <item>
      <title>CORS Error while fetching access token from HMRC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cors-error-while-fetching-access-token-from-hmrc/m-p/12117462#M1973992</link>
      <description>&lt;P&gt;I am trying to fetch access token from HMRC Sandbox API. The below code works completely fine when I test it from my web IDE. But it doesn't work as the same in the client's system. The only difference in code is the redirect URI in the client system which is also a HTTPS link. I cannot disable web security or add CORS plugin. Is there any other way to fix this issue?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;var postQuery ={};
postQuery.code = that.code;
postQuery.client_id = that.getView().getModel("appView").getProperty("/clientID");
postQuery.client_secret = that.getView().getModel("appView").getProperty("/clientSecret");
postQuery.grant_type ="authorization_code";
postQuery.redirect_uri ="https://webidetesting4631275-p*******trial.dispatcher.hanatrial.ondemand.com/webapp/index.html?hc_orionpath=/DI_webide_di_workspaceletjq4u76joab5p6/Run_Reports";
$.post("https://test-api.service.hmrc.gov.uk/oauth/token", postQuery,function(data){
  console.log(data);});&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;&amp;lt;img src="https://answers.sap.com/storage/temp/1731534-error.png"&amp;gt;&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Sep 2019 08:05:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cors-error-while-fetching-access-token-from-hmrc/m-p/12117462#M1973992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-09-16T08:05:34Z</dc:date>
    </item>
  </channel>
</rss>

