<?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 Re: Problem with React/authorization in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/6104082#M14050</link>
    <description>&lt;P&gt;I am also facing the same issue. Were you able to resolve this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 May 2024 18:25:19 GMT</pubDate>
    <dc:creator>krantikc</dc:creator>
    <dc:date>2024-05-30T18:25:19Z</dc:date>
    <item>
      <title>Problem with React/authorization</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/5658905#M11276</link>
      <description>&lt;P&gt;Hi guys, im new to programming, but i really started to enjoy it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want to make a web app that after pressing a button, creates playlist with last 10 songs you listened to.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I ALMOST got it working, however I found one big obstacle.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;create_playlist&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;async&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;e&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; { &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;e&lt;/SPAN&gt;&lt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lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;JSON&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;stringify&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"SpotEx"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;fetch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;`&lt;A href="https://api.spotify.com/v1/users/HERE_IS_MY_PROFILE_ID/playlists" target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/users/HERE_IS_MY_PROFILE_ID/playlists&lt;/A&gt;`&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;reqOptions&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;json&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;I can use code like that, it creattes playlist and works. However if any other account would login, thus different Profile ID, it will stop working.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;await&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;fetch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;`&lt;A href="https://api.spotify.com/v1/users/${user}/playlists" target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/users/${user}/playlists&lt;/A&gt;`&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;reqOptions&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Provides me with CORS errors that&amp;nbsp; I cannot resolve&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;Access to XMLHttpRequest at '&lt;A href="https://api.spotify.com/v1/users/[object%20Object]/playlists" target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/users/[object%20Object]/playlists&lt;/A&gt;' from origin '&lt;A href="http://localhost:3000" target="_blank" rel="noopener"&gt;http://localhost:3000&lt;/A&gt;' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 28 Oct 2023 11:51:34 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/5658905#M11276</guid>
      <dc:creator>BMak1</dc:creator>
      <dc:date>2023-10-28T11:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with React/authorization</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/5658931#M11278</link>
      <description>&lt;P&gt;You'll need to add other accounts (up to 25) to the dashboard of your app when it is in development mode. After it is ready to publish to the public, you can request a quota extension.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 13:27:42 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/5658931#M11278</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-10-28T13:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with React/authorization</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/6104082#M14050</link>
      <description>&lt;P&gt;I am also facing the same issue. Were you able to resolve this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 18:25:19 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Problem-with-React-authorization/m-p/6104082#M14050</guid>
      <dc:creator>krantikc</dc:creator>
      <dc:date>2024-05-30T18:25:19Z</dc:date>
    </item>
  </channel>
</rss>

