Invalid redirect URI on spotify auth

I try to auth user through my app with spotify Web API but I receive this error:

INVALID_CLIENT: Invalid redirect URI

URL:

GET https://accounts.spotify.com/authorize/?client_id=6ae90bf75bf748c8874a75d16682f0c5&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&scope=user-read-private%20user-read-email

I cant see where is the problem... Can you help?

You have to add the redirect URI to the White-list in "My Applications" panel.

e.g http://example.com/callback/

arirawr commented on May 21, 2018 Hi @lonnibesancon - you need to go into your dashboard on Spotify for Developers, select your app, and add the redirect URI to your app by clicking on "Edit Settings". arirawr closed this on May 21, 2018

app.js:

var redirect_uri = 'http://localhost:8888/callback';

(https://developer.spotify.com/dashboard) Spotify > My application:

http://localhost:8888/callback

Dont forget to save.

Invalid redirect URI for spotify. using AngularJS and uses a PostMessage to communicate between the redirect URI Spotify API auth in PHP - Invalid redirect URI.

I ran into a similar issue when authenticated via Authorization Code Flow.

Per the docs The value of this parameter must exactly match the value of redirect_uri supplied when requesting the authorization code. So make sure that the:

  1. redirect_uri that is configured in the dashboard
  2. redirect_uri in the GET https://accounts.spotify.com/authorize
  3. redirect_uri in the POST https://accounts.spotify.com/api/token

is exactly the same or else you will get a INVALID_CLIENT: Invalid redirect URI

You need to whitelist your redirect URI on the Spotify Developer dashboard for your app. You then need to use the exact same URI when making your initial request to the Spotify accounts service - and I mean, exactly the same. No trailing slashes, no HTTPS instead of HTTP. If they don't match exactly, it will not work.

First. You have to be sure that you're using app.js from authorization_code directory.

Second. Be sure you edited app.js. That third line is important.

var client_id = '---'; // Your client id
var client_secret = '---'; // Your secret
var redirect_uri = 'http://localhost:8888/callback'; // Your redirect uri - EXAMPLE

Hi. I'm still getting "INVALID_CLIENT: Invalid redirect URI" after clicking on the "Request Token" button. After clearing my cookies, I was able to get two additional pages, the first one was a selection between logging in and signing up to Spotify, the second one was a selection between Facebook login and Spotify login.

I use the SpotifyAPI-NET API wrapper by JohnnyCrazy and was having this problem despite adding the URL I specified in my wrapper call to my white list as specified above.

The browser's address bar should show the redirect URL it is using buried in the middle of the string - I found that it was also making a request with "https://accounts.spotify.com:8000/authorize" as the redirect URL - perhaps the wrapper is making 2 API calls, but I found that only by whitelisting both this URL and the one I was specifying would it work for me.

INVALID_CLIENT: Invalid redirect URI – activedecay Oct 19 '18 at 19:34. add a comment | Spotify API auth in PHP - Invalid redirect URI. Hot Network Questions

This URI needs to have been entered in the Redirect URI whitelist that you specified when you registered your application. The value of redirect_uri here must exactly match one of the values you entered when you registered your application, including upper or lowercase, terminating slashes, and such. state: Optional, but strongly recommended.

The redirect uri is where the client will get send to after the account authorization is successful. You could also set up a redirect for an authorization failure. I have not used the Spotify API but looking at the documents it appears that when you register your application you will add a redirect uri to the white-list.

Whitelist a Redirect URI. In Redirect URIs enter one or more addresses that you want to whitelist with Spotify. This URI enables the Spotify authentication service to automatically re-launch your app every time the user logs in. To Enter URI for an App on iOS: Verify that: All the characters are lowercase. The prefix must be unique to your

Comments
  • Ok, i added the url in the white list but i get the same error.
  • I forgot to add slash after redirect_uri. Redirect url need to be eq with the url from the white list. Thank you for help mallendeo.
  • and then what? I am running a CLIENT not a server.
  • Spotify App Panel > Edit Settings > Add URL
  • Works perfectly!
  • This answer is still relevant in 2020 and solved my problem, thank you.