Retrieve access token from the Spotify API
Matdweb opened this issue · comments
About this Issue
For this app we are using the Spotify API. As establish on this page it is necessary, in the flow of work of this API as first step, to retrieve an access token
from the Spotify API to start making some other requests.
Now here you can see how to retrieve this token
. Actually you need to follow this:
- make a
POST
request with the usersession-token
, remember we are usingjwt
for this app's authentication managment. You can learn more about it here and here - use the correct body object for the
POST
request
--header "Authorization: Bearer
session-token
"
- handle correctly the retrievement of this
token
/api/spotify/accessToken
This endpoint is created in the app to make all of the previous process in the backend. Bringing security and correct handling to sensitive data.
Important
- When the
token
is successfully retrieved; It needs to be securely stored in the newSpotifyContext
so that the rest of the app has access to it, see ticket #7 and its respective PR. - When the token is already securely stored in the Context. It's very important that every time the token is request in any part of the app, a verification of the value is made to make sure we have a valid token, otherwise it must request other one with the
/api/spotify/accessToken
path
Test
To test that the POST
request to Spotify API and the accessToken
storage are working as expected.
The solution should test this with the 'Save this in Spotify'
Button, printing the new accessToken
value to the console.
Since this is going to be the first thing this Button
is going to need to do.