1

I have tried using sp.core.user.canonicalUsername and m.User in various variants, I even tried to get the username by traversing through the m.playlists.starredPlaylist. This is probably easy but I can't find it somewhere?

Christian Landgren
  • 13,127
  • 6
  • 35
  • 31

3 Answers3

3

This is from a Spotify employee:

"Personally-indentifiable information like username won't be available, ever."

Typically, they want you to use Facebook Auth for any social features.

Apparently Spotify will be releasing new documentation in a week or so, so keep an eye out and see if it sheds any light.

Peter Watts
  • 720
  • 4
  • 16
1

It won't be available, but you can obtain an unique user id with sp.core.getAnonymousUserId()

Juan Riaza
  • 1,618
  • 2
  • 16
  • 35
1

It appears that you can use

var sp = getSpotifyApi(1);
var models = sp.require('sp://import/scripts/api/models');
models.session.anonymousUserID

From the Api Reference:

anonymousUserID  string     Get an anonymous user ID, which is unique per-user, per-application.