plietar / librespot

Open Source Spotify client library
MIT License
1.14k stars 185 forks source link

Hide password from ps #258

Closed c0da closed 7 years ago

c0da commented 7 years ago

Hello, is there a way to hide/mask my password from the ps command? Thanks in advance!

ramn commented 7 years ago

Are you referring to the example app?

christophgysin commented 7 years ago

You can use the Discovery Mode to avoid passing the password as an argument.

c0da commented 7 years ago

Hmmm not exactly, @ramn.. When I run librespot with 'username' and 'password' as arguments, any other user can see my spotify's password by running a ps command:

user@pandora:~$ ps -ef  | grep spot
root      2664  2554  1 10:22 pts/0    00:00:00 librespot --username XXXX --password XXXX --name testing

And @christophgysin , when I try to use the Discovery Mode, it shows:

# librespot -n testing
INFO:librespot: librespot e109de2 (2017-10-02). Built on 2017-10-03. Build ID: AgkKXwi6
WARN:mdns: Failed to register IPv6 receiver: Error { repr: Os { code: 19, message: "No such device" } }

And that's it, that is all I see. Is it supposed to do/show something else? (maybe ask for my user/pass for a first time and save it somewhere else?)

Thanks in advance!

christophgysin commented 7 years ago

It should be advertising itself via mDNS. Start another spotify client on a device in the same network, and it should show up under "Devices". When you select your device running libspotify, they will exchange authentication tokens and librespot should connect to spotify.

Once connected, you can control it from any other spotify client, even if not on the same network.

c0da commented 7 years ago

Thank you @christophgysin. For some reason it's not working (not showing up under 'devices') for me.. Is there any chance to use an 'appkey' file? I think it was possible on older versions, but it seems that for some reason the option was removed.

herrernst commented 7 years ago

You can just specify a username and omit the password argument, then librespot asks interactively. Also, if you use a cache directory (-c argument), some kind of authentication token is saved in credentials.json, so you don't have to enter the password again.

c0da commented 7 years ago

Thank you @herrernst, It worked like a charm! My problem now is how to use the 'cache' argument in snapcast server (SNAPSERVER_OPTS) as it seems it's not supported, but I guess that's not a question for this thread. Thank you again!