-
Notifications
You must be signed in to change notification settings - Fork 0
/
spotify.ts
42 lines (34 loc) · 989 Bytes
/
spotify.ts
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
36
37
38
39
40
41
42
// helper for Spotify
import SpotifyWebApi from "spotify-web-api-node";
const scopes = [
"user-read-email",
"playlist-read-private",
"playlist-read-collaborative",
"user-read-email",
"streaming",
"user-read-private",
"user-library-read",
// "user-library-modify",
"user-top-read",
"user-read-playback-state",
"user-modify-playback-state",
"user-read-currently-playing",
"user-read-recently-played",
"user-follow-read",
].join(",");
const params = {
scope: scopes,
};
const queryParamsString = new URLSearchParams(params);
const LOGIN_URL = `https://accounts.spotify.com/authorize?${queryParamsString.toString()}`;
/*
const LOGIN_URL =
"https://accounts.spotify.com/authorize?" + queryParamsString.toString();
*/
//console.log("**********8" + LOGIN_URL);
const spotifyApi = new SpotifyWebApi({
clientId: process.env.NEXT_PUBLICCLIENT_ID,
clientSecret: process.env.NEXT_PUBLIC_CLIENT_SECERT,
});
export default spotifyApi;
export { LOGIN_URL };