codetheweb / aoede

🎧 a self-hosted Spotify → Discord music bot
MIT License
300 stars 29 forks source link

AuthenticationError out of nowhere #54

Open gjorgdy opened 3 months ago

gjorgdy commented 3 months ago

Without initially changing my login info the bot started randomly throwing this error. After changing my password, resetting the bot token and completely redeploying the bot, the issue persists.


Error creating session: AuthenticationError(LoginFailed(BadCredentials))
stack backtrace:
   0:     0x7fc796892955 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h56c396e6ec1a6d25
   1:     0x7fc7968d911b - core::fmt::write::h8d9f62e4196a6251
   2:     0x7fc79688f30f - std::io::Write::write_fmt::hfeda4b672809964d
   3:     0x7fc79689272e - std::sys_common::backtrace::print::h92792842c9200fcf
   4:     0x7fc796893b89 - std::panicking::default_hook::{{closure}}::h4fa40162feafd3ea
   5:     0x7fc7968938cd - std::panicking::default_hook::h5a52bd4fbc34f99c
   6:     0x7fc796894023 - std::panicking::rust_panic_with_hook::h33e85abbf3f92159
   7:     0x7fc796893f04 - std::panicking::begin_panic_handler::{{closure}}::h6e89e0968a11dcc7
   8:     0x7fc796892e19 - std::sys_common::backtrace::__rust_end_short_backtrace::h6f80b72bde67d6fa
   9:     0x7fc796893c37 - rust_begin_unwind
  10:     0x7fc795bd6193 - core::panicking::panic_fmt::hb37c2646452904e3
  11:     0x7fc795bd6626 - core::result::unwrap_failed::h95d9de04097dd2c4
  12:     0x7fc795c756d3 - tokio::park::thread::CachedParkThread::block_on::hd895f2033877e8c0
  13:     0x7fc795cb912c - aoede::main::ha78334ca8f072fe4
  14:     0x7fc795d5eea3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9b5c3c6c0dbe6e5d
  15:     0x7fc795dd8d59 - std::rt::lang_start::{{closure}}::h56f4d6a086b65f76
  16:     0x7fc796887ded - std::rt::lang_start_internal::ha99684538b0582d2
  17:     0x7fc795cb9345 - main```
ChrisMoriarty commented 3 months ago

I'm seeing the same, and I'm using the docker container if that's useful.

gerrowadat commented 3 months ago

My guess is this is server-side - I'm seeing this with current and also previous version of Aoede.

shiftybitshiftr commented 3 months ago

It appears basic auth for apps has been deprecated by Spotify: https://github.com/librespot-org/librespot/issues/1308#issuecomment-2276196094

codetheweb commented 3 months ago

Happy to accept a PR that updates the README / credential handling.

tomich commented 3 months ago

Hey @shiftybitshiftr . I just built your branch. The bot doesn't work if I don't input my user AND password. And it still claims failed auth and Spotify ends up resetting my password. Did you implement the new auth in a ready usable state or do I need to do something else?

As it is right now I dont think this is mergable as it doesn't work out of the box.

Maybe I'm missing something?

EDIT: I'm super stupid. Sorry. I built the main and zeroconf branches and was testing the main one. My bad. Will test zeroconf now. Sorry for my mistake.

shiftybitshiftr commented 3 months ago

Hi Tomas, the branch is still being worked on (need to debug audio quality issues and add storage for the encrypted blob) but the auth portion is working. Are you sure you built from the right source? My branch doesn't use a password env var.

On Thu, Sep 5, 2024 at 12:06 PM Tomas Caram @.***> wrote:

Hey @shiftybitshiftr https://github.com/shiftybitshiftr . I just built your branch. The bot doesn't work if I don't input my user AND password. And it still claims failed auth and Spotify ends up resetting my password. Did you implement the new auth in a ready usable state or do I need to do something else?

As it is right now I dont think this is mergable as it doesn't work out of the box.

Maybe I'm missing something?

— Reply to this email directly, view it on GitHub https://github.com/codetheweb/aoede/issues/54#issuecomment-2332447211, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJODL4VURAMDHY6HSKUCWLZVCTSNAVCNFSM6AAAAABMIS3JXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSGQ2DOMRRGE . You are receiving this because you were mentioned.Message ID: @.***>

tomich commented 3 months ago

My mistake @shiftybitshiftr . Sorry. I built main and zeroconf branches and was using the main-based docker file.

I've built from the zeroconf to test. I'm building the Dockerfile (if that info is useful in any way).

I still need a SPOTIFY_USERNAME even if it's not mentioned in the readme.

After setting SPOTIFY_USERNAME it doesn't work because I believe the docker container is running inside the docker network. That is going to be a problem for people running this bot in production environments outside a local home network. I'll check what ports I need for the spotify autodiscovery to work (I guess 5353 UDP) and if I need to set any special routing in addition. I don't think 5353/udp will be a simple thing to share from within Docker environments.

shiftybitshiftr commented 3 months ago

Thanks for the feedback, let's move discussion into #55.

You need to set --net=host for docker run or network_mode: host for compose to get the mDNS to propagate (although it ultimately depends on how your local network is configured). We will save the generated auth blob to file so it can be run in a remote environment after initial setup.