-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspotify.js
35 lines (28 loc) · 867 Bytes
/
spotify.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import SpotifyWebApi from 'spotify-web-api-node'
const scopes = [
'user-read-email',
'user-read-private',
// 'user-library-modify',
'user-library-read',
'user-top-read',
'user-read-playback-state',
'user-modify-playback-state',
'user-read-currently-playing',
'user-read-recently-played',
'user-follow-read',
'streaming',
'playlist-read-collaborative',
'playlist-read-private',
].join(',')
const params = {
scope: scopes,
}
const queryParamString = new URLSearchParams(params)
const LOGIN_URL = `https://accounts.spotify.com/authorize?${queryParamString.toString()}`
const spotifyApi = new SpotifyWebApi({
clientId: process.env.NEXT_PUBLIC_CLIENT_ID,
clientSecret: process.env.NEXT_PUBLIC_CLIENT_SECRET,
})
export default spotifyApi
export { LOGIN_URL }
// https://accounts.spotify.com/authorize?