RylandDeGregory / SpotifyWebAPIAuth

Obtain a user OAuth 2 Refresh token from the Spotify API using Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spotify Authorization Code flow sample

NOTE: This repo is no longer required for using the SpotifyExporter application, as it now has a PowerShell method of obtaining an OAuth 2 Refresh Token using Get-SpotifyRefreshToken.ps1.


Adapted from the Spotify web-app-auth-examples repo.

This repository contains a basic application showing the Authorization Code OAuth 2.0 flow for authenticating against the Spotify Web API.

Install Node.js and app dependencies

This example runs on Node.js. On the Node.js website you can find instructions on how to install it.

Once installed, clone the repository and install its dependencies by running:

npm install

Using your own credentials

You will need to register an app and get your own credentials from the Spotify for Developers Dashboard.

To do so, go to your Spotify for Developers Dashboard and create an application. For the example, I registered this Redirect URI:

Once you have created your app, replace the client_id, client_secret, and redirect_uri in the example with the ones you get from My Applications.

Running the example

In order to run the example, run its app.js file:

cd authorization_code
node app.js

Then, open http://localhost:8888 in a browser.

About

Obtain a user OAuth 2 Refresh token from the Spotify API using Node.js.

License:Apache License 2.0


Languages

Language:JavaScript 51.0%Language:HTML 49.0%