Important: Please read the Qt Code of Conduct -

QOAuth2AuthorizationCodeFlow accessing Spotify

  • I am trying to make this project to work.

    I changed mainwindow.cpp:22 to use my Client Id, and mainwindow.cpp:23 to use my Client Secret, that I registered for my app at Spotify.

    But it does not matter which Redirect URI I set for my app registration, at Spotify, this example uses redirect_uri=http://localhost/:8080 in the URL. I tried to edit it to redirect_uri=https://localhost/:8080, as I (think I) read somewhere, but with no results: the browser reports INVALID_CLIENT: Invalid redirect URI.

    I also tried to insert replyHandler->setProperty("redirect_uri", "https://localhost:8080/"); after line 19.

    I also read this, this and this, but I just couldn't get it to work.

    Later, I had the idea to clear the "data of the hosted app" in the browser's cache (I dont know if that's the English name, as my browser runs in pt-br) , and the login page at last appeared!!

    I have to click 3 times on the Login button for the Gotcha to appear (click on the images with cars, etc), but nothing happens in the browser or in the app. I even created a premium account at Spotify, but it made no difference.

    Any help will be much appreciated!!


  • Moderators

    Are you sure you want to redirect to https://localhost:8080?? Note the https!
    If not then change it to http://localhost:8080
    If it's correct check that you have OpenSSL binaries available for your app.

    I have no idea if QOAuthHttpServerReplyHandler is capable of SSL, but this was what came to my mind first.

  • That was exactly the problem: misconfiguration between what I registered at Spotify, and what the app was using.

    Thanks a lot!

Log in to reply