To make the application more flexible and easy to configure, we are going to create a configuration file. This way, we don't need to hardcode the URL and access keys; also, if we need to change these settings, changes in the source code will not be required. We are going to create a config file in the YAML format to store information that will be used by our application to authenticate, make requests to the Spotify RESP API endpoints, and so on.
Let's go ahead and create a file called config.yaml
in the musicterminal
directory with the following contents:
client_id: '<your client ID>' client_secret: '<your client secret>' access_token_url: 'https://accounts.spotify.com/api/token' auth_url: 'http://accounts.spotify.com/authorize' api_version: 'v1' api_url: 'https://api.spotify.com' auth_method: 'AUTHORIZATION_CODE'
client_id
and client_secret
are the keys that were created for us when we created the Spotify application...