Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
spotify-personal-auth
Advanced tools
Readme
A Spotify authorization code flow implementation for local personal use.
Install with npm:
$ npm i spotify-personal-auth --save
const auth = require('spotify-personal-auth')
const SpotifyWebApi = require('spotify-web-api-node')
// Configure module
auth.config({
clientId: 'YOUR_CLIENT_ID', // Replace with your client id
clientSecret: 'YOUR_CLIENT_SECRET', // Replace with your client secret
scope: ['user-modify-playback-state', 'user-top-read'], // Replace with your array of needed Spotify scopes
path: '/path/to/a/tokens.json' // Optional path to file to save tokens (will be created for you)
})
const api = new SpotifyWebApi()
/* Get token promise, the token will refresh if this is called when it has expired,
* But you can get the refresh token if you would rather handle it
* It is resolve as an array containing the token and refresh as shown below
*/
auth.token().then(([token, refresh]) => {
// Sets api access and refresh token
api.setAccessToken(token)
api.setRefreshToken(refresh)
return api.getMyTopTracks()
}).then(data =>
// Plays user's top tracks
api.play({
uris: data['body']['items'].map(item => item['uri'])
})
).catch(console.log)
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Install dev dependencies:
$ npm i -d && npm test
Tomer Aberbach
Copyright © 2019 Tomer Aberbach Released under the MIT license.
FAQs
A Spotify authorization code flow implementation for local personal use.
The npm package spotify-personal-auth receives a total of 0 weekly downloads. As such, spotify-personal-auth popularity was classified as not popular.
We found that spotify-personal-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.