spotify-web-api-node icon indicating copy to clipboard operation
spotify-web-api-node copied to clipboard

Multi user config

Open DJHammers opened this issue 2 years ago • 1 comments

let spotifyApi = new SpotifyWebApi();
        spotifyApi
            .authorizationCodeGrant(`auth code`)
            .then(function (data) {
                console.log('Retrieved access token', data.body['access_token']);
                spotifyApi.setAccessToken(data.body['access_token']);
                return spotifyApi.getMe();
            })
            .then(function (data) {
                console.log('Retrieved data for ' + data.body['display_name']);
                console.log('Image URL is ' + data.body.images[0].url);

                console.log('This user has a ' + data.body.product + ' account');
            })
            .catch(function (err) {
                console.log('Something went wrong:', err.message);
            });

am using this on multiuser project so it only use authorizationCodeGrant to fetch user why its giving

Something went wrong: An authentication error occurred while communicating with Spotify's Web API.
Details: invalid_client.

the readme file says client is optional

// credentials are optional
var spotifyApi = new SpotifyWebApi({
  clientId: 'fcecfc72172e4cd267473117a17cbd4d',
  clientSecret: 'a6338157c9bb5ac9c71924cb2940e1a7',
  redirectUri: 'http://www.example.com/callback'
});

but actually they are required how do i fix this

DJHammers avatar Jan 05 '23 14:01 DJHammers

i need to log in to bot like spotify-web-api-js npm it only require accesstoken

DJHammers avatar Jan 14 '23 15:01 DJHammers