thelinmichael / spotify-web-api-node

A Node.js wrapper for Spotify's Web API.
http://thelinmichael.github.io/spotify-web-api-node/
MIT License
3.1k stars 499 forks source link

TypeError: createAuthorizeURL is not a function error #399

Open tknura opened 3 years ago

tknura commented 3 years ago

Hi, I am using this method as shown in an example and on method execution i get an error:

TypeError: spotifyApi.createAuthorizeURL is not a function

I get it only with using version 5.0.2, when I downgraded package to 4.0.0 it works fine

const spotifyApi = new SpotifyWebApi({
    clientId:  <client id>,
    redirectUri: <redirect uri>
  })

  const authorizeUrl = spotifyApi.createAuthorizeURL(scopes, state)
furkanayilmaz commented 2 years ago

You will need to get the authroizationURL in node. If you try it in React it will throw an error. Try to do it in Node.JS

7coil commented 2 years ago

If you're using Webpack, don't forget to add the target: "node" setting to not accidentally package the module along with your code.