Invalid redirect URI on spotify auth

前端 未结 11 1248
日久生厌
日久生厌 2021-02-03 16:56

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

INVALID_CLIENT: Invalid redirect URI

URL:

GET         


        
相关标签:
11条回答
  • 2021-02-03 17:27

    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

    0 讨论(0)
  • 2021-02-03 17:27

    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.

    0 讨论(0)
  • 2021-02-03 17:27

    Include a path after the first pair of forward slashes. For example: Your app name is My Awesome App The redirect URI may be my-awesome-app-login://callback or awesomeprotocol123://returnafterlogin.

    For more information please refer this link Spotify Redirect URI Example

    0 讨论(0)
  • 2021-02-03 17:37

    This error also appears when the redirect_uri is missing in the request. I figured that out the hard way due to writing "redirect_url" (with an L) instead.

    Took me way too long to figure out. Hopefully this can save someone else some time.

    0 讨论(0)
  • 2021-02-03 17:38

    Navigate to your Spotify developer dashboard and open the project you are working on.

    Next click "edit settings" and look for the redirect URIs field.

    Put your redirect URI in the field. ex: http://localhost:8888/callback

    Click save.

    You should be good

    0 讨论(0)
  • 2021-02-03 17:40

    This is super specific, so make sure you have exact url in each place.

    In my app dashboard on spotify I had: http://localhost:3005/

    And my url is: https://accounts.spotify.com/authorize?client_id=XXXXXXXXXXXXXXXXX&response_type=code&redirect_uri=http %3A%2F%2Flocalhost:3005/&scope=user-read-currently-playing%20user-top-read

    Note the trailing slash in both places.

    0 讨论(0)
提交回复
热议问题