-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I am making a Discord bot that creates playlists from song links that are post in a Discord channel. I am running into the following error:
Error: Bad or expired token. This can happen if the user revoked a token or the access token has expired. You should re-authenticate the user. In the docs it says to use the client credentials if you are making a server side application.
This is the relevant code:
try {
this.sdk = SpotifyApi.withClientCredentials(this.clientId, this.clientSecret, [
"playlist-modify-public",
"user-library-read",
"playlist-modify-private",
"user-read-private",
"user-read-email",
]);
} catch (error) {
console.error(error);
}
const profile = await this.sdk?.currentUser?.profile();
The authentication part runs without error but the profile part throws the error. If I hardcode my user id and try creating the playlist with the following code I just the same error:
const playlist = await this.sdk?.playlists.createPlaylist(userId, {
name: name,
collaborative: false,
description: description,
public: false,
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels