• Stars
    star
    198
  • Rank 196,898 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This service logs in to Spotify and redirects the user to a given frontend application with a valid access_token in the url.

OAuth bridge template

This service logs in to Spotify and redirects the user to a given frontend application with a valid access_token as a parameter in the url.

Development mode

In development mode, it assumes you are running the frontend on localhost:3000, but the server itself will be running on localhost:8888.

In order to start developing, register a Spotify Application here: https://developer.spotify.com/my-applications

On that page, add http://localhost:8888 as a callback url (don't forget to hit save at the bottom of the page)

Write the below commands in your terminal (replacing XXXX AND YYYY with your acutal client id and secret from the page where you registered your application)

export SPOTIFY_CLIENT_ID=XXXX
export SPOTIFY_CLIENT_SECRET=YYYY
npm start

Then go to http://localhost:8888/login in your browser. This will initiate the login flow and finally redirect to http://localhost:3000?access_token=ZZZZZ where ZZZZZ is a valid access token that you can use to do operations in the Spotify API.

Deploying to production

This template is indended to be deployed on Heroku. After installing the heroku CLI tools you can run the below commands in the same directory as server.js(replacing abc123, cba456, mybackend and myfrontend with your actual stuff - the below example assume that you already have your frontend running on http://myfrontend.herokuapp.com.

heroku create mybackend
heroku config:set SPOTIFY_CLIENT_ID=abc123
heroku config:set SPOTIFY_CLIENT_SECRET=cba456
heroku config:set REDIRECT_URI=https://mybackend.herokuapp.com/callback
heroku config:set FRONTEND_URI=https://myfrontend.herokuapp.com
git push heroku master

You should now be able to go to http://mybackend.herokuapp.com/login and it will eventually redirect to http://myfrontend.herokuapp.com?access_token=ZZZZZwhere ZZZZZ is a valid access token that you can use to do operations in the Spotify API.

More Repositories

1

unprecedented-midwife

Hello world in modern JS
JavaScript
148
star
2

supersniff

A simple function for debugging stuff like promise chains and other pipeline-like thingees. It just creates a function that console logs whatever is passed to it and then returns that value.
JavaScript
131
star
3

fff-graphql-goodreads

JavaScript
116
star
4

fpjs8

JavaScript
78
star
5

better-playlists

JavaScript
72
star
6

wasm-rust-example

Small rust / webassembly example
HTML
51
star
7

workroom-lights-killer

Code for a video I maded
JavaScript
48
star
8

powerpinkplay

JavaScript
28
star
9

myvoicething

JavaScript
26
star
10

junction-example

Code from episode https://youtu.be/y7-qkrTtOTw
JavaScript
26
star
11

funfunautomator

Automate fun fun things
JavaScript
25
star
12

ffforumautomator

JavaScript
25
star
13

funfunapp

Example app for Continuous Integration.
JavaScript
24
star
14

unit-testing-series

JavaScript
22
star
15

funfuniterators

Code from the Fun Fun Function episode Iterators in JavaScript using Quokka
JavaScript
20
star
16

snurra

A communication bus with a strict request/response interface, aiming to make unit testing simpler, by treating side effects as data.
JavaScript
18
star
17

kyrene

JavaScript
17
star
18

ticket-lottery

JavaScript
16
star
19

funfunfield

JavaScript
12
star
20

maximumsheep-web

JavaScript
7
star
21

playlist-app-launchdarkly

JavaScript
6
star
22

fff-graphql-example

JavaScript
5
star
23

peer-dependency-cleaner

Simple command line tool to clean up the mess that npm link and peerDependencies creates
JavaScript
5
star
24

funfunfruitmachine

JavaScript
5
star
25

cannonville

JavaScript
5
star
26

spa-base

Just a simple template app for quickly getting Single Page Application (SPA) running
JavaScript
4
star
27

discourse-graphql-server

JavaScript
3
star
28

quickpagetemplate

JavaScript
3
star
29

spotifympj

JavaScript
3
star
30

beautiful-lies

Test doubles for asynchronous JavaScript that are easy on the eyes.
CoffeeScript
3
star
31

returnmeto

JavaScript
3
star
32

landergame

JavaScript
2
star
33

allmaktisverige

Ruby
2
star
34

supercalc

Wallaby demo
JavaScript
2
star
35

jaycut-rails

A (very tiny) library for accessing the JayCut API from Ruby on Rails.
2
star
36

jaycut-dotnet-example

WARNING! THIS REPOSITORY IS NO LONGER MAINTAINED. Go to https://github.com/jaycut/jaycut-dotnet-example
C#
2
star
37

caloriestreak

JavaScript
1
star
38

nomma

JavaScript
1
star
39

madeforwalking

JavaScript
1
star
40

wienerschnitzel-web

JavaScript
1
star
41

redux-probe

A new way to test redux apps
JavaScript
1
star
42

fffish

JavaScript
1
star
43

translatingturk

Ruby
1
star
44

stockholmhotline

1
star
45

alladin

JavaScript
1
star
46

submarinegame

JavaScript
1
star
47

bus-thing

JavaScript
1
star
48

ardodnu

JavaScript
1
star
49

meteormonkey

1
star
50

nomoneparser

CoffeeScript
1
star
51

errorii

JavaScript
1
star
52

html5wheeldemo

JavaScript
1
star
53

nomdb

Ruby
1
star
54

collabplay

JavaScript
1
star
55

imastupidcat

Ruby
1
star
56

find-mismatch-deep

Deep find the first mismatch between an object and a pattern
JavaScript
1
star
57

rainfall

1
star
58

B02

1
star
59

stellar-watch

CoffeeScript
1
star
60

substrate-test-1

Rust
1
star
61

qrforum

Ruby
1
star
62

spotify-knockout

JavaScript
1
star
63

restaurants

1
star
64

tree-thing

JavaScript
1
star
65

mpj

1
star
66

kodaporstockholm

JavaScript
1
star
67

inheritance

JavaScript
1
star