<?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: Invalid client in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598229#M9667</link>
    <description>&lt;P&gt;Since [&lt;A href="https://developer.spotify.com/documentation/web-api/tutorials/client-credentials-flow" target="_blank" rel="noopener nofollow noreferrer"&gt;Client Credentials&lt;/A&gt;] do not include authorization, only endpoints that do not access user information can be accessed.&lt;/P&gt;&lt;P&gt;The page of the&amp;nbsp;&lt;A href="https://developer.spotify.com/documentation/web-api/reference/get-the-users-currently-playing-track" target="_blank" rel="nofollow noopener noreferrer"&gt;Get Currently Playing Track&lt;/A&gt;&amp;nbsp;endpoint access user data, and it mentions Authorization scopes.&lt;/P&gt;&lt;P&gt;So implementing the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developer.spotify.com/documentation/web-api/tutorials/code-flow" target="_blank" rel="noopener nofollow noreferrer"&gt;Authorization Code Flow&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is required to let your app work.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2023 05:19:18 GMT</pubDate>
    <dc:creator>Ximzend</dc:creator>
    <dc:date>2023-06-20T05:19:18Z</dc:date>
    <item>
      <title>Invalid client</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598132#M9664</link>
      <description>I started making my own music display app. I chose to use the Spotify API, I don't have a premium subscription (can the problem arise because of this?) . I registered the app, got a secret client and a client ID.  Here's my code. &lt;BR /&gt;async getData(){&lt;BR /&gt;            let result = await fetch('&lt;A href="https://accounts.spotify.com/api/token" target="_blank"&gt;https://accounts.spotify.com/api/token&lt;/A&gt;', {&lt;BR /&gt;                method: 'POST', &lt;BR /&gt;                headers: {&lt;BR /&gt;                    'Content-Type' : 'application/x-www-form-urlencoded', &lt;BR /&gt;                    'Authorization': 'Basic' + btoa(this.client_id + ':' + this.client_secret)&lt;BR /&gt;                },&lt;BR /&gt;                body: 'grant_type=client_cred&lt;BR /&gt;&lt;BR /&gt;Why do I get an error 400, error: 'invalid_client' response from the server</description>
      <pubDate>Mon, 19 Jun 2023 20:31:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598132#M9664</guid>
      <dc:creator>Well-Wisher</dc:creator>
      <dc:date>2023-06-19T20:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid client</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598168#M9666</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;i don't think this is because you don't have premium account in sdk docs its stated on first line that its only for premium users in web api there is no mention of that, anywhere.&lt;/P&gt;&lt;P&gt;the code doesn't look complete so i can't be sure but if i am correct then the function is inside some class? please post the whole code there could be some bug else but most bugs in code are because we forget about the simple things. Are you sure that you have correct client_id and client_secret pasted in? Somebody had similar problem and it was just a typo (&lt;A href="https://community.spotify.com/t5/Spotify-for-Developers/INVALID-CLIENT-invalid-client/td-p/5410735" target="_blank"&gt;https://community.spotify.com/t5/Spotify-for-Developers/INVALID-CLIENT-invalid-client/td-p/5410735&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;if you are sure that its correct can you please try this code, i have tested this code and i got the access_token.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;async function getToken(){
    const authOptions = {
        url: `https://accounts.spotify.com/api/token`,
        method: 'POST',
        headers: {
            'Authorization': 'Basic ' + btoa(client_id + ':' + client_secret),
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: 'grant_type=client_credentials'
    };

    fetch(authOptions.url, authOptions)
        .then(response =&amp;gt; response.json())
        .then(data =&amp;gt; {
            console.log(data);
        }).catch(error =&amp;gt; {
            console.error(error);
    });
}

getToken();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;if this doesn't work can you run it in browser console and look at the network tab and provide more info. i am sure that it will be useful debug info even for more competent people than i am.&lt;/P&gt;&lt;P&gt;i hope that i have helped at least a little qwq&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 23:21:47 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598168#M9666</guid>
      <dc:creator>Halina20011</dc:creator>
      <dc:date>2023-06-19T23:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid client</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598229#M9667</link>
      <description>&lt;P&gt;Since [&lt;A href="https://developer.spotify.com/documentation/web-api/tutorials/client-credentials-flow" target="_blank" rel="noopener nofollow noreferrer"&gt;Client Credentials&lt;/A&gt;] do not include authorization, only endpoints that do not access user information can be accessed.&lt;/P&gt;&lt;P&gt;The page of the&amp;nbsp;&lt;A href="https://developer.spotify.com/documentation/web-api/reference/get-the-users-currently-playing-track" target="_blank" rel="nofollow noopener noreferrer"&gt;Get Currently Playing Track&lt;/A&gt;&amp;nbsp;endpoint access user data, and it mentions Authorization scopes.&lt;/P&gt;&lt;P&gt;So implementing the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developer.spotify.com/documentation/web-api/tutorials/code-flow" target="_blank" rel="noopener nofollow noreferrer"&gt;Authorization Code Flow&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is required to let your app work.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 05:19:18 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598229#M9667</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-06-20T05:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid client</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598306#M9671</link>
      <description>&lt;P&gt;Thank you, you helped a lot in solving my question, now everything works! I am very grateful to you&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 08:10:43 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Invalid-client/m-p/5598306#M9671</guid>
      <dc:creator>Well-Wisher</dc:creator>
      <dc:date>2023-06-20T08:10:43Z</dc:date>
    </item>
  </channel>
</rss>

