Reputation: 81
I'm trying to progress through the Spotify developer API tutorial but when I try to access the user login page I get this error. I've triple checked that the URI in the code matches the one on MyApplications page but it still won't work. Here's the script,
var express = require('express'); // Express web server framework
var request = require('request'); // "Request" library
var querystring = require('querystring');
var cookieParser = require('cookie-parser');
var client_id = id;
var client_secret = secret;
var redirect_uri = "http://localhost:8888/callback";
Image of error code and MyApplications page
I'm not sure what I'm doing wrong but I've been going over it for hours now, can someone help?
Upvotes: 8
Views: 17257
Reputation: 835
I just needed to restart my Node server!
Steps to fix:
callback
. http://localhost:8888/callback/
Upvotes: 6
Reputation: 1275
You need your redirect URIs to be exactly the same. The URI you have registered in the Dashboard is http://localhost:8888/callback/ with a trailing slash. The version you use in your code does not have the trailing slash. Just change your redirect_uri to be:
var redirect_uri = "http://localhost:8888/callback/";
You can verify that this works with this example authorize URL I made: https://accounts.spotify.com/en/authorize?client_id=df5c5a57b94a4817ae3ac4760c701983&redirect_uri=http:%2F%2Flocalhost:8888%2Fcallback%2F&scope=streaming%20user-read-birthdate%20user-read-private%20user-modify-playback-state&response_type=token&show_dialog=true
Upvotes: 12