BalenaSound Spotify Authentication

Ok, I’ve searched the Internet and read all the docs.

Basic newbie question: what is the use case for setting the Spotify login variables?

Currently my devices show up a as both Spotify connect options and I can even go into AirPlay and they work that way as well, all while both the balena devices and the phone I’m using are all on the same network.

So when does Librespot utilize the credentials in the variables?

Thanks
Simon

Hey Simon welcome to the forums. It’s my understanding that if you use the credentials you can use Spotify connect via the internet rather than having to be present on the same local network. Like yourself though, I’m having a hard time finding documentation of this anywhere online, but from experience in the past that’s what it does.

If you do decide to try it and confirm that this is the case do let us know or submit a PR to the balenaSound documentation and we can make sure folks like yourself can find this information in the future! :slight_smile:

I guess that’s where i’m confused.

What does that mean “via the internet”?

Theoretically you could be on Spotify away from your home and play music through BalenaSound?

I guess we could test by turning off wifi and seeing if your phone Spotify will still see the spotify connect option going through cell data only?

I am assuming that you don’t need to expose your system publicly (i.e. set a public IP) to do this?

So I just tried it.

Spotify has a very specific message that you need to be on the same wifi as the device you want to use through Spotify Connect, so if you do not have wifi enabled on your phone, no connect devices show up, and if you’re connected to a different wifi (I have two separate networks in my house), then no connect devices show up except those on that specific wifi network.

So I’m still unclear as to how this is intended to function?

Hi @sjgharib, balenaSound developer here. Let me clarify, you DO need a Spotify premium account for the plugin to work. This is a requirement of librespot which is the library we use detailed explanation on this here: Change librespot to support free accounts · Issue #261 · librespot-org/librespot · GitHub, basically they would be breaking ToS if they allow free accounts).

So when does Librespot utilize the credentials in the variables?

To answer your original question, there are two ways to login with your premium account, one of which is zeroconf, it uses your logged premium account on your phone/device so you don’t need to provide user/pass via SOUND_SPOTIFY_USERNAME and SOUND_SPOTIFY_PASSWORD. I realize this is not really well documented so i’ll create a PR now to fix it.

Also, almost forgot…

via the internet

If you provide credentials via environment variables you can stream from your phone on a different network. That’s what the “via the internet” means. To be honest it’s not a very useful feature so we’ll probably remove that from the docs to prevent confusion.