witnessmenow / spotify-api-arduino

Arduino library for integrating with the Spotify Web-API (Does not play music)
MIT License
178 stars 33 forks source link

Update documentation regarding the getRefreshToken #40

Closed PaulskPt closed 1 year ago

PaulskPt commented 2 years ago

Hi Brian, yesterday I managed to run the getRefreshToken successfully, but only after performing some steps that I did not read in the documentation. Beside opening a Developers account on Spotify and creating a 'first application', I discovered that, only after performing two other steps, the getRefreshToken procedure was executing successfully. The two extra steps are these: 1) in your Spotify Developers Dashboard. Click on the icon (big green square) of your first application. Then click on the button "Settings". In the item "Rederict URIs" add the "http:///callback/", e.g. "http://192.168.1.114/callback/". Then click on the button "ADD". This white-lists the given address to rederict to after authentication success OR failure. 2) Next, back in the dashboard of your first app, click on the button "USERS AND ACCESS". In the next page click left down on the button "+ ADD NEW USER". There you will be asked to enter the full name and his/hers Spotify Account e-mail address of the user to add. I added myself as first user. One can add 25 users for each app (or ask Spotify for an 'extension'). After this all has been done you can leave the Spotify Developer site. Next run the getRefreshToken sketch in the Arduino IDE. Have the Arduino IDE Monitor window open When you see that the sketch is running go inside a webbrowser. Go to http:// (e.g. "http://192.168.1.114"); press . On the next page that shows only a short link in the upper left of the window, click on that link; watch the Monitor Window. There will be output of exchange of authentication protocol. When things proceed OK, there will pop up a window in your webbrowser, in top the Spotify logo, below it the name you gave to your first app and a text with three items you must AGREE upon (you give consent that users of your app can view your Spotify account data; view your activity on Spotify; Take actions in Spotify on your behalf. This page also informs you how to remove your authorization to users of your app. After I clicked the AGREE button, immediately arrived the RefreshToken on the webbrowser page as in the dialogue printed onto the IDE's Monitor window. I'll add some screenshots.

Final note: In the getRefreshToken.ino sketch, I un-commented the line 96 (#define USE_IP_ADDRESS 1", to use the MDNS option. I modifed line 104 to contain the IP-addres (192.168.1.114) instead of "arduino.local".

2021-10-20_23h44_Redirect_callback_URI_white-listed_img0

2021-10-20_20h35_Spotify_Developer_Dashboard_1stt_app_1st_user_added_v2

2021-10-20_23h16_Authorization_given_for_users_of_my_1st_app_

PaulskPt commented 2 years ago

Correction on my 'Final note' in my post above must start with: ' In the getRefreshToken.ino sketch, I commented-out line 96' (used: //).

witnessmenow commented 2 years ago

Hi Paulus,

Step 1 should be covered by the instructions on the top of the get refresh token example if I'm not mistaken

Step 2 is definitely something I never needed to do in the past , once I created the key and set the callback I was able run the example and login to Spotify and accept the newly created app having access to my account, I definitely didn't need to add an email/account details on the dashboard. But maybe that has changed, I'll take a look at in the next few weeks

Thanks for the feedback!

PaulskPt commented 2 years ago

Hi Brian, Thank you for the rapid response. I just deleted the one user (myself) from the app user list. Then tried the Album Art example (modified by me because of some errors I will report in another issue (I am thinking about a PR). It was able to get authorized and it ran OK. So, you are right about that step 2. Conclusion: for the examples to work one doesn't need to add / authorize users to the app.

witnessmenow commented 1 year ago

I think we can close this, feel free to reply if you dont think so @PaulskPt !