Jamming Project - getAccessCode returns Invalid redirect URI

Hi!
I’ve been working on the jamming project, and I’m currently stuck in step 79 trying to get the access token and expiration time.

To start off, I’m just trying to get redirected to my site after the Spotify authentication, but I always get an ‘INVALID_CLIENT: Invalid redirect URI’ error.

My function currently looks like this:

const baseURL = 'https://accounts.spotify.com/authorize';
const query =
    `${baseURL}?client_id=${clientID}&response_type=token&redirect_uri=http://localhost:3000/`;

I searched the forums and saw other people using the same redirect uri and succeeding, so what am I missing?

Hi Nadav,
I don’t remember which step that is: did you already set the Redirect URIs in your Spotify Dashboard to your localhost address?
I also have ‘&scope=playlist-modify-public’ in my query chain. No idea if that’s necessary. Probably not.
If none of that is the issue, I guess you have to post the whole getAccessToken() function since the error must be anywhere else in your code then.

1 Like

set the Redirect URIs in your Spotify Dashboard

That is exactly the piece of information I was missing. Thank you for the quick solution!!

1 Like