<?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: Getting wrong redirect uri in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6117953#M14131</link>
    <description>&lt;P&gt;And in your code it is also set to port 3001?&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 04:57:17 GMT</pubDate>
    <dc:creator>Ximzend</dc:creator>
    <dc:date>2024-06-06T04:57:17Z</dc:date>
    <item>
      <title>Getting wrong redirect uri</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6117548#M14129</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm implementing my first app using&amp;nbsp;&lt;A title="web player sdk docs" href="https://developer.spotify.com/documentation/web-playback-sdk/howtos/web-app-player" target="_blank" rel="noopener"&gt;web player sdk docs&lt;/A&gt;, I have set in my app&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;A href="http://localhost:3001/spotify/auth/callback" target="_blank" rel="noopener"&gt;http://localhost:3001/spotify/auth/callback&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;as redirect url, saved the configuration, but after performing login (with facebook for example) then I get&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;INVALID_CLIENT: Invalid redirect URI&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I see from the payload that the uri is different:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;&lt;DIV class=""&gt;redirect_uri:&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;A href="http://localhost:3000/auth/callback" target="_blank" rel="noopener"&gt;http://localhost:3000/auth/callback&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;How come is coming with this value?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Jun 2024 22:49:24 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6117548#M14129</guid>
      <dc:creator>falconea</dc:creator>
      <dc:date>2024-06-05T22:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Getting wrong redirect uri</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6117953#M14131</link>
      <description>&lt;P&gt;And in your code it is also set to port 3001?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 04:57:17 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6117953#M14131</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2024-06-06T04:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting wrong redirect uri</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6119455#M14138</link>
      <description>&lt;P&gt;This is my code, as you can see the redirect_uri is set with 3001port and actually is a different url...&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;router.get("/auth/callback", (req, res) =&amp;gt; {
  var code = req.query.code;

  var authOptions = {
    url: "https://accounts.spotify.com/api/token",
    form: {
      code: code,
      redirect_uri: "http://localhost:3001/spotify/auth/callback",
      grant_type: "authorization_code",
    },
    headers: {
      Authorization:
        "Basic " +
        Buffer.from(
          process.env.SPOTIFY_CLIENT_ID +
            ":" +
            process.env.SPOTIFY_CLIENT_SECRET
        ).toString("base64"),
      "Content-Type": "application/x-www-form-urlencoded",
    },
    json: true,
  };

  request.post(authOptions, function (error, response, body) {
    if (!error &amp;amp;&amp;amp; response.statusCode === 200) {
      access_token = body.access_token;
      res.redirect("/");
    }
  });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 21:23:29 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Getting-wrong-redirect-uri/m-p/6119455#M14138</guid>
      <dc:creator>falconea</dc:creator>
      <dc:date>2024-06-06T21:23:29Z</dc:date>
    </item>
  </channel>
</rss>

