Node Express app that handles token exchange for the Spotify Authorization Code flow
Note: For more information about Spotify Authorization, please visit https://developer.spotify.com/documentation/general/guides/authorization-guide/
Visit the Spotify developer portal (https://developer.spotify.com/) and create an application setting a CLIENT_ID, SECRET and REDIRECT_URI.
CLIENT_ID - is generated by Spotify
CLIENT_SECRET - also generated by spotify
REDIRECT_URI - This Url should match the callback route of this hosted application
e.g (https://myspotauth/callback) or localhost:5000/callback for local development callbacks.
.env file provided containing the keys of required environment vars.
Update this file with your App vars for local development.
There is an additional two env vars to be set:
FINAL_URI - This is the Url which will be loaded if authorisation and the token request is succesful.
A spotify Token will be returned to this Url as a QueryString parameter. This token can be parsed and then used to in subsequent requests to the Spotify Api.
STATEKEY - The name given to the cookie used during auth.
This doesn't require a change from
With the Env vars configured in a .env file, the app can be started locally
The Express application to a Node.js environment such as Heroku, plese see above note about setting environment variables.
Note Within Heroku, the environment vars are set via the CLI, for example:
heroku config:set CLIENT_ID=1234567809fdsnfj
Once hosted, from another application you can:
Note: There is currently no functionality within this token swap for requesting Refresh tokens.