-
Notifications
You must be signed in to change notification settings - Fork 0
/
spotify.js
40 lines (33 loc) · 894 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
36
37
38
39
40
const SpotifyWebApi = require('spotify-web-api-node');
const config = require('./config');
const clientId = config.client_id;
const clientSecret = config.client_secret;
const redirectUri = config.redirect_uri;
const spotifyApi = new SpotifyWebApi({
clientId,
clientSecret,
redirectUri
});
const authorizationCodeGrant = (code) => {
return spotifyApi.authorizationCodeGrant(code);
}
const createAuthorizeURL = (scope, state) => {
return spotifyApi.createAuthorizeURL(scope, state)
}
const setAccessToken = (accessToken) => {
return spotifyApi.setAccessToken(accessToken);
};
const setRefreshToken = (refresh_token) => {
return spotifyApi.setRefreshToken(refresh_token);
};
const getMe = (name, defaultValue) => {
return spotifyApi.getMe();
};
module.exports = {
setAccessToken,
setRefreshToken,
getMe,
createAuthorizeURL,
authorizationCodeGrant,
spotifyApi
};