<?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 GET https://api.spotify.com/v1/me 403 Error in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/GET-https-api-spotify-com-v1-me-403-Error/m-p/5266256#M3301</link>
    <description>&lt;P&gt;Premium&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Switzerland&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;HP Notebook&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Spotify-Web-Api-Node:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Authorization Code Grant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a Project using React. Somehow, I keep getting the 403 Error on no matter what endpoint I'm asking for. Trying to execute any of the calls, I get these responds inside the browser console:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_3r4y__0-1632679258318.png" style="width: 602px;"&gt;&lt;img src="https://community.spotify.com/t5/image/serverpage/image-id/133414i2BE8653DC91FBD56/image-dimensions/602x214?v=v2" width="602" height="214" role="button" title="_3r4y__0-1632679258318.png" alt="_3r4y__0-1632679258318.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure, where to begin, since that error doesn't really give an answer on what could be wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I'm using looks like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Component
    const spotifyApi = new SpotifyWebApi();
    const accessToken = useAuth(code); //custom hook
    useEffect(() =&amp;gt; {
        if (!accessToken) return;
        spotifyApi.setAccessToken(accessToken)
        spotifyApi.getMe();
    }, [accessToken])


// useAuth hook
    const [accessToken, setAccessToken] = useState()
    const [refreshToken, setRefreshToken] = useState()
    const [expiresIn, setExpiresIn] = useState()


    useEffect(() =&amp;gt; {
        axios.post('http://localhost:3001/login', { 
                code,
            })
            .then(res =&amp;gt; {
                setAccessToken(res.data.accessToken)
                setRefreshToken(res.data.refreshToken)
                setExpiresIn(res.data.expiresIn)
                window.history.pushState({}, null, "/")
            })
            .catch(() =&amp;gt; {
                window.location = "/"
        })
    }, [code])

// server
const express = require('express');
const cors = require('cors');
const SpotifyWebApi = require('spotify-web-api-node');
const app = express();
app.use(cors());    
app.use(express.urlencoded({extended: true}));
app.use(express.json());

app.post('/login', (req, res) =&amp;gt; {
    const code = req.body.code
    const spotifyApi = new SpotifyWebApi({
        clientId: '1d9716b896714fdb9bbc9f0de3195d42',
        clientSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        redirectUri: 'http://localhost:3000'
    })

    spotifyApi
    .authorizationCodeGrant(code)
    .then(data =&amp;gt; {
        res.json({
            accessToken: data.body.access_token,
            refreshToken: data.body.refresh_token,
            expiresIn: data.body.expires_in
        })
    })
    .catch(() =&amp;gt; {
        res.sendStatus(400)
    })
})
app.listen(3001)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: My useAuth hook returns the accesstoken and it's output seems to be fine.&lt;/P&gt;&lt;P&gt;Also, I got two other methods inside of the server and the useAuth hook which do the refreshtoken-part but that shouldn't have to do anything with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd be thankful about every help i can get &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Sun, 26 Sep 2021 18:16:52 GMT</pubDate>
    <dc:creator>_3r4y_</dc:creator>
    <dc:date>2021-09-26T18:16:52Z</dc:date>
    <item>
      <title>GET https://api.spotify.com/v1/me 403 Error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/GET-https-api-spotify-com-v1-me-403-Error/m-p/5266256#M3301</link>
      <description>&lt;P&gt;Premium&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Switzerland&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;HP Notebook&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Spotify-Web-Api-Node:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Authorization Code Grant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a Project using React. Somehow, I keep getting the 403 Error on no matter what endpoint I'm asking for. Trying to execute any of the calls, I get these responds inside the browser console:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_3r4y__0-1632679258318.png" style="width: 602px;"&gt;&lt;img src="https://community.spotify.com/t5/image/serverpage/image-id/133414i2BE8653DC91FBD56/image-dimensions/602x214?v=v2" width="602" height="214" role="button" title="_3r4y__0-1632679258318.png" alt="_3r4y__0-1632679258318.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure, where to begin, since that error doesn't really give an answer on what could be wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I'm using looks like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Component
    const spotifyApi = new SpotifyWebApi();
    const accessToken = useAuth(code); //custom hook
    useEffect(() =&amp;gt; {
        if (!accessToken) return;
        spotifyApi.setAccessToken(accessToken)
        spotifyApi.getMe();
    }, [accessToken])


// useAuth hook
    const [accessToken, setAccessToken] = useState()
    const [refreshToken, setRefreshToken] = useState()
    const [expiresIn, setExpiresIn] = useState()


    useEffect(() =&amp;gt; {
        axios.post('http://localhost:3001/login', { 
                code,
            })
            .then(res =&amp;gt; {
                setAccessToken(res.data.accessToken)
                setRefreshToken(res.data.refreshToken)
                setExpiresIn(res.data.expiresIn)
                window.history.pushState({}, null, "/")
            })
            .catch(() =&amp;gt; {
                window.location = "/"
        })
    }, [code])

// server
const express = require('express');
const cors = require('cors');
const SpotifyWebApi = require('spotify-web-api-node');
const app = express();
app.use(cors());    
app.use(express.urlencoded({extended: true}));
app.use(express.json());

app.post('/login', (req, res) =&amp;gt; {
    const code = req.body.code
    const spotifyApi = new SpotifyWebApi({
        clientId: '1d9716b896714fdb9bbc9f0de3195d42',
        clientSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        redirectUri: 'http://localhost:3000'
    })

    spotifyApi
    .authorizationCodeGrant(code)
    .then(data =&amp;gt; {
        res.json({
            accessToken: data.body.access_token,
            refreshToken: data.body.refresh_token,
            expiresIn: data.body.expires_in
        })
    })
    .catch(() =&amp;gt; {
        res.sendStatus(400)
    })
})
app.listen(3001)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: My useAuth hook returns the accesstoken and it's output seems to be fine.&lt;/P&gt;&lt;P&gt;Also, I got two other methods inside of the server and the useAuth hook which do the refreshtoken-part but that shouldn't have to do anything with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd be thankful about every help i can get &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sun, 26 Sep 2021 18:16:52 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/GET-https-api-spotify-com-v1-me-403-Error/m-p/5266256#M3301</guid>
      <dc:creator>_3r4y_</dc:creator>
      <dc:date>2021-09-26T18:16:52Z</dc:date>
    </item>
  </channel>
</rss>

