Closed BrandonErik-FS closed 1 year ago
I read the Spotify Authentication Workflow Documentation and was able to set up a login, callback and search route in the Express backend API. At the time of writing the API is able to request an authorization code from Spotify, send a request for a token and store the valid token in the MongoDB database. Additionally, I created a middleware that I added to the search route to ensure that a valid JSON web token is available before making a request to the Spotify API. The middleware, will redirect the user back to authorize the app if there is no token in the database. If an invalid token is in the database, the middleware will refresh the token and update it before moving on. And if there is a valid token in the database it will just send a search request to the Spotify API with the valid token.
Complete the following tasks: