damontecres / StashAppAndroidTV

Android TV App for Stash
GNU Affero General Public License v3.0
62 stars 5 forks source link

[BUG] - won’t connect to API #269

Closed byertsy closed 2 months ago

byertsy commented 2 months ago

Description

I had previously installed stash app on my nvidia shield and it connected to my server and worked well.

I then had a computer issue and have had to setup another instance of stash from scratch which came with a new API code.

The app will not connect to the new API code. The rest of the system is setup the same, although traefik is upgraded to v3.0. I input the URL and it accepts this, and on the API page I get a message saying ‘Connected to the server, but needs an API code’. I then input the code and when I press ‘enter’ it just gives me the same message again and does not progress with the setup like it did before.

I have installed the app, and have now reinstalled it, upgrading to the latest update, but it still fails with the same issue.

Reproduction steps

1. Click on '...'
2. Scroll to '....'
3. See error

Device

NVIDIA shield pro 2019

Logs

No response

byertsy commented 2 months ago

I’m an idiot - the container is running behind authelia, which it wasn’t before. I assume this would be the issue?

damontecres commented 2 months ago

Hi @byertsy, yes, I think Authelia would be the problem here. This app can only authenticate with Stash via the ApiKey HTTP header. Since Authelia is probably not checking that header, I bet it just returns a 401 or 403 back to the app which causes the message you mentioned.

I bet you could write an access control policy in Authelia to bypass Authelia's auth for requests to your Stash server if there's an ApiKey HTTP header going to https://<stash-server>/graphql and let Stash handle checking the api key then.

byertsy commented 2 months ago

Yep, that’s exactly what I’ve ended up doing and it works like a charm. 👍