1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-07-07 01:20:48 +00:00

Fix code to work on this decade 1/x

This commit is contained in:
Christer Warén
2024-02-10 09:33:59 +02:00
parent 99ecd9787d
commit 86b4676159
61 changed files with 3842 additions and 471 deletions

View File

@ -0,0 +1,28 @@
module.exports = async function (client) {
const request = require("request");
const refresh_token = client.config.spotify_refresh_token;
const authOptions = {
url: "https://accounts.spotify.com/api/token",
headers: {
Authorization: "Basic " +
new Buffer(client.config.spotify_client_id + ":" + client.config.spotify_client_secret).toString("base64"),
},
form: {
grant_type: "refresh_token",
refresh_token: refresh_token,
},
json: true,
};
request.post(authOptions, function (error, response, body) {
if (!error && response.statusCode === 200) {
client.spotify.setAccessToken(body.access_token);
client.config.spotify_access_key = body.access_token
if (client.config.devMode) console.log("- Spotify access token set -");
} else {
console.log("An error occured whilst getting spotify access key");
}
});
};