Code Monkey home page Code Monkey logo

spotify-zeroconf's Introduction

spotify-zeroconf

Spotify Web API authentication, the easy way.

npm version


About this library

spotify-zeroconf is a partial rewrite of librespot that has one goal:

To provide you with a Spotify Web API token without having to input your username and password.

How does it work

Basically, this library takes advantage of the Spotify Connect protocol and brodcasts itself as a Spotify compatible device on your network. Once you click on the device using any Spotify client (desktop, mobile…), it will perform multiple handshakes and authentication rounds with the Spotify access points, and provide you with a token that you will be able to use with the Spotify Web API.


Click to get the credentials!


There are more details in the librespot wiki (especially the Authentication and Connection parts).

Installation

npm i spotify-zeroconf

Usage

const spotifyZeroconf = require('spotify-zeroconf')

// Only clientId is required.
const credentials = await spotifyZeroconf({
    clientId: // [Required] Id of your spotify application
    scope: // Scopes with a comma separator. Defaults to a list containing every scope. (see here: https://developer.spotify.com/documentation/general/guides/scopes/)
    deviceName: // Name of the device that appears on the network. Defaults to 'Spotify Zeroconf'.
    noCache: // If true, will not store the first handshake credentials and will force the device to appear on the network every time the function is called. Defaults to false.
    authType: // 'token' (default) or 'code'. Code will give you an access code that you can exchange for a token and a refresh_token, but you will need the client_secret. (see here: https://developer.spotify.com/documentation/general/guides/authorization-guide/#2-have-your-application-request-refresh-and-access-tokens-spotify-returns-access-and-refresh-tokens)
})

// Web API token.
console.log(credentials.accessToken)

spotify-zeroconf's People

Contributors

dependabot[bot] avatar elbywan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.