<?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 Error: No 'Access-Control-Allow-Origin' header is present on the requested resource in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-No-Access-Control-Allow-Origin-header-is-present-on-the/m-p/350280#M10395</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I am trying to get the access token in order to embed the Power BI report. When i fetch the token using &lt;STRONG&gt;AcquireTokenAsync&lt;/STRONG&gt; in C# application it works fine. But when i try to get the access token in my javascript code it throws below error:&lt;BR /&gt;&lt;BR /&gt;"Failed to load &lt;STRONG&gt;&lt;A href="https://login.microsoftonline.com/common/oauth2/token" target="_blank"&gt;https://login.microsoftonline.com/common/oauth2/token&lt;/A&gt;&lt;/STRONG&gt;: Response to preflight request doesn't pass access control check: &lt;STRONG&gt;No 'Access-Control-Allow-Origin' header is present on the requested resource&lt;/STRONG&gt;. Origin 'http://localhost:65159' is therefore not allowed access."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone kindly guide me on how to workaround this error in order to obtain access token in Javascript.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prateek Raina&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2018 04:47:27 GMT</pubDate>
    <dc:creator>prateekraina</dc:creator>
    <dc:date>2018-02-02T04:47:27Z</dc:date>
    <item>
      <title>Error: No 'Access-Control-Allow-Origin' header is present on the requested resource</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-No-Access-Control-Allow-Origin-header-is-present-on-the/m-p/350280#M10395</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I am trying to get the access token in order to embed the Power BI report. When i fetch the token using &lt;STRONG&gt;AcquireTokenAsync&lt;/STRONG&gt; in C# application it works fine. But when i try to get the access token in my javascript code it throws below error:&lt;BR /&gt;&lt;BR /&gt;"Failed to load &lt;STRONG&gt;&lt;A href="https://login.microsoftonline.com/common/oauth2/token" target="_blank"&gt;https://login.microsoftonline.com/common/oauth2/token&lt;/A&gt;&lt;/STRONG&gt;: Response to preflight request doesn't pass access control check: &lt;STRONG&gt;No 'Access-Control-Allow-Origin' header is present on the requested resource&lt;/STRONG&gt;. Origin 'http://localhost:65159' is therefore not allowed access."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone kindly guide me on how to workaround this error in order to obtain access token in Javascript.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prateek Raina&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 04:47:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-No-Access-Control-Allow-Origin-header-is-present-on-the/m-p/350280#M10395</guid>
      <dc:creator>prateekraina</dc:creator>
      <dc:date>2018-02-02T04:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Error: No 'Access-Control-Allow-Origin' header is present on the requested resource</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-No-Access-Control-Allow-Origin-header-is-present-on-the/m-p/351506#M10446</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/21838"&gt;@prateekraina&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on my research, it should be a&amp;nbsp;&lt;SPAN&gt;CORS problem. &lt;A href="https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present" target="_self"&gt;Here&lt;/A&gt; is a similar thread in which some workaround are mentioned. Could your go to check if it works in your scenario?&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;This is not a fix for production or when application has to be shown to the client, this is only helpful when UI and Backend&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;development&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are on different&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;servers&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and in production they are actually on same server. For example: While developing UI for any application if there is a need to test it locally pointing it to backend server, in that scenario this is the perfect fix.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;For production fix, CORS headers has to be added to the backend server to allow cross origin access.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The easy way is to just add the extension in google chrome to allow access using CORS.&lt;/P&gt;
&lt;P&gt;(&lt;A href="https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en-US" target="_blank"&gt;https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en-US&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;Just enable this extension whenever you want allow access to no&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;'access-control-allow-origin'&lt;/STRONG&gt;header request.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Or&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In Windows, paste this command in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;window&lt;/P&gt;
&lt;PRE class="default prettyprint prettyprinted"&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;chrome&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;exe &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;--&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;user&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;data&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;dir&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"C:/Chrome dev session"&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;--&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;disable&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;web&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;security&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this will open a new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;chrome&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;browser which allow access to no&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;'access-control-allow-origin'&lt;/STRONG&gt;header request&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 07:26:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-No-Access-Control-Allow-Origin-header-is-present-on-the/m-p/351506#M10446</guid>
      <dc:creator>v-ljerr-msft</dc:creator>
      <dc:date>2018-02-05T07:26:50Z</dc:date>
    </item>
  </channel>
</rss>

