Issues with Authorization Code workflow, receiving 403 response to /me/top/artists requests
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm new to this API so bear with me, but currently I'm using the example node.js code from the documentation to test getting user authorization codes. When I run the example code I successfully receive an access and refresh token, however when I try to make a /me/top/artists request I get a 403 Forbidden response. I've tried it with two different accounts, each in my User Management dashboard, to no avail. Below is the JS from the example showing how I formatted my scopes, incase there is an error. I've also included the python attempting to make the request, which has worked for me with non-user requests fine.
app.get('/login', function(req, res) {
var state = generateRandomString(16);
res.cookie(stateKey, state);
// your application requests authorization
var scope = 'user-read-private user-read-email';
res.redirect('https://accounts.spotify.com/authorize?' +
querystring.stringify({
response_type: 'code',
client_id: client_id,
scope: 'user-read-private playlist-read-private playlist-read-collaborative user-top-read user-read-recently-played',
redirect_uri: redirect_uri,
state: state
}));
});
def topPicks(time_range: str, limit: str):
print(token)
url = 'https://api.spotify.com/v1/me/top/artists?time_range=' + time_range + '&limit=' + limit + '&offset=0'
auth = 'Bearer ' + token
headers = {'Authorization': auth}
r = requests.get(url, headers=headers)
Labels:
- Labels:
-
Question
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page