<?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 Receiving a 'Only valid bearer authentication supported' 400 error in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483089#M7513</link>
    <description>&lt;P&gt;When making an API call to&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;A href="https://api.spotify.com/v1/me/top/," target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/me/top/,&lt;/A&gt;&amp;nbsp;I am unable to receive the user's top results and get a 400 error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;When making an API call to&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;A href="https://api.spotify.com/v1/search," target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/search,&lt;/A&gt;&amp;nbsp;I am able to receive values searched.&lt;BR /&gt;&lt;BR /&gt;Can anyone see the difference in why? I can console.log(data) succesfully, but not console.log(data2). TIA!&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  useEffect(() =&amp;gt; {
    getUsersFavoriteTracks();
  }, []);

  const getUsersFavoriteTracks = async () =&amp;gt; {
    const { data } = await axios.get(
      "https://api.spotify.com/v1/search",

      {
        headers: {
          Authorization: `Bearer ${token}`,
        },
        params: {
          q: "Hotel Surrender",
          type: "album",
        },
      }
    );
    console.log(data);
    const { data2 } = await axios.get("https://api.spotify.com/v1/me/top/", {
      headers: {
        Authorization: `Bearer ${token}`,
      },
      params: {
        type: "artists",
      },
    });
    console.log(data2);
  };​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 04:00:12 GMT</pubDate>
    <dc:creator>grootzy</dc:creator>
    <dc:date>2023-01-05T04:00:12Z</dc:date>
    <item>
      <title>Receiving a 'Only valid bearer authentication supported' 400 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483089#M7513</link>
      <description>&lt;P&gt;When making an API call to&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;A href="https://api.spotify.com/v1/me/top/," target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/me/top/,&lt;/A&gt;&amp;nbsp;I am unable to receive the user's top results and get a 400 error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;When making an API call to&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;A href="https://api.spotify.com/v1/search," target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/search,&lt;/A&gt;&amp;nbsp;I am able to receive values searched.&lt;BR /&gt;&lt;BR /&gt;Can anyone see the difference in why? I can console.log(data) succesfully, but not console.log(data2). TIA!&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  useEffect(() =&amp;gt; {
    getUsersFavoriteTracks();
  }, []);

  const getUsersFavoriteTracks = async () =&amp;gt; {
    const { data } = await axios.get(
      "https://api.spotify.com/v1/search",

      {
        headers: {
          Authorization: `Bearer ${token}`,
        },
        params: {
          q: "Hotel Surrender",
          type: "album",
        },
      }
    );
    console.log(data);
    const { data2 } = await axios.get("https://api.spotify.com/v1/me/top/", {
      headers: {
        Authorization: `Bearer ${token}`,
      },
      params: {
        type: "artists",
      },
    });
    console.log(data2);
  };​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 04:00:12 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483089#M7513</guid>
      <dc:creator>grootzy</dc:creator>
      <dc:date>2023-01-05T04:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving a 'Only valid bearer authentication supported' 400 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483154#M7514</link>
      <description>&lt;P&gt;Did you get the access token by following the &lt;A href="https://developer.spotify.com/documentation/general/guides/authorization/code-flow/" target="_blank" rel="noopener"&gt;Authorization Code Flow&lt;/A&gt;?&lt;/P&gt;&lt;P&gt;Also, did you request it by using the &lt;A href="https://developer.spotify.com/documentation/general/guides/authorization/scopes/" target="_blank" rel="noopener"&gt;Authorization Scope&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;"user-top-read"?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 07:25:53 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483154#M7514</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-01-05T07:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving a 'Only valid bearer authentication supported' 400 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483713#M7530</link>
      <description>&lt;P&gt;&lt;BR /&gt;Thanks Ximzend for narrowing it down, I didn't set the authorization scope.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you could imagine this is my href to authenticate, how can I properly use the&amp;nbsp;&lt;STRONG&gt;user-top-read?&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;a&lt;/SPAN&gt; &lt;SPAN&gt;className&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"button"&lt;/SPAN&gt; &lt;SPAN&gt;href&lt;/SPAN&gt;&lt;SPAN&gt;={&lt;/SPAN&gt;&lt;SPAN&gt;`&lt;/SPAN&gt;&lt;SPAN&gt;${&lt;/SPAN&gt;&lt;SPAN&gt;AUTH_ENDPOINT&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;?client_id=&lt;/SPAN&gt;&lt;SPAN&gt;${&lt;/SPAN&gt;&lt;SPAN&gt;CLIENT_ID&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;redirect_uri=&lt;/SPAN&gt;&lt;SPAN&gt;${&lt;/SPAN&gt;&lt;SPAN&gt;REDIRECT_URI&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;scope=user&amp;amp;20top&amp;amp;20read&amp;amp;response_type=&lt;/SPAN&gt;&lt;SPAN&gt;${&lt;/SPAN&gt;&lt;SPAN&gt;RESPONSE_TYPE&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;`&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;Login to Spotify&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;a&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Jan 2023 04:26:52 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483713#M7530</guid>
      <dc:creator>grootzy</dc:creator>
      <dc:date>2023-01-06T04:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving a 'Only valid bearer authentication supported' 400 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483749#M7532</link>
      <description>&lt;P&gt;&amp;amp;20 is a space, but it just needs to be a user&lt;STRONG&gt;-&lt;/STRONG&gt;to&lt;STRONG&gt;-&lt;/STRONG&gt;read, without encoding the - symbols.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 12:13:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5483749#M7532</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-01-06T12:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving a 'Only valid bearer authentication supported' 400 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5484116#M7539</link>
      <description>&lt;P&gt;Thanks Ximzend, problem solved.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 19:50:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Receiving-a-Only-valid-bearer-authentication-supported-400-error/m-p/5484116#M7539</guid>
      <dc:creator>grootzy</dc:creator>
      <dc:date>2023-01-06T19:50:14Z</dc:date>
    </item>
  </channel>
</rss>

