-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to authenticate to user #2
Comments
So turns out, I was just missing a comma, however I'm still getting an error:
|
Could you post your docker ENV variables setup? |
sure
|
Does your album have pictures in it? Are you sure it's the right album ID? It looks like it's not getting any album contents back. |
The album definitely has pictures in it (1k+ pictures). I'm not 100% sure I have the right ID though. I grabbed the ID by navigating to the album and then copying the numbers at the end of the address bar in my browser:
Is that the right way to do it? |
Any thoughts on whether I'm grabbing the right album ID? @pman07 |
Well, that should be it. Where did you get your Immich API Key? Is it still active? |
I created 2 new keys (tested both, both give the same error as above) by going to my username on the top right, then 'Account Settings', then 'API Keys', then 'New API Key'. I even created a test album with only a few pictures in it (vs my main album with has a few thousand and is shared with a few people just in case). Here is my compose file in case something is wonky there:
And here is the main.py file, which I have mapped outside the container to allow me to add auth to my ntfy instance. I only made 2 changes to this file, which I bolded below:
I made 2 changes to the above file: I added in the authorization for my ntfy instance:
And I changed a hard coded local IP from 192.168.1.80 to 192.168.1.18, which I assumed was a mistake?
If I leave the above portion of main.py as it is in the repo:
the following shows up, but nothing happens (no notification, etc.):
|
I don't see anything glaring that's wrong. If I make the same changes to my copy it still works, but I don't have NTFY authentication setup currently. Good catch on the hardcoded local IP, that's embarrassing. I'm working on a fix for that as well as adding optional authentication. Would you be able to test the following out and see if it works for you? Add AUTHORIZATION_KEY to your Docker stack.env variables
|
@feerlessleadr I've updated the container to fix the hardcoded IP and hopefully add support for Basic Auth. If you get a chance to try it out, let me know how it goes! |
Thanks - I updated my compose to remove mapping the main.py outside of the container:
I also updated my stack.env for the auth:
I re-pulled the contaner and let this run and all I get in the docker log is:
It seems like the script is running every minute now? However I do not get a notification nor is the data.txt created. I know that my ntfy instance is working, as I'm using it for other scripts/services, so not sure where I'm going wrong. |
@feerlessleadr Ahh I see a documentation error. There needs to be your Immich port number in the stack.env variable BASEURL=http://192.168.1.18:2283 I'll fix that in the ReadMe. Apologies. |
No worries. I'm definitely getting somewhere. I have a new error:
|
Hmm. Are you familiar with the program Postman? If so, could you try sending a "GET" to https://pics.mydomain.com/api/album/1009fc79-72ea-4875-b6a4-a493ad205632 with Authorization set to Bearer Token and paste your Immich API token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX I'm curious if your API access isn't working with your key. What the error means is that when calling the album API to check the album contents it's not seeing the albumName in the response. |
I'm not familiar, but I was able to sign up and download the program. It looks like the issue is an invalid key. I'm not sure how that's possible though, as I just created a new key, copied it into the postman and re-ran the request, and I'm still getting the below error in postman:
Am I creating the key correctly? I'm going to my username on the top right, then 'Account Settings', then 'API Keys', then 'New API Key', then copying the key, then clicking done. ::EDIT:: Ok, so things are getting stranger and stranger. I ran across this issue, thinking I was having the same problem. I created another new api key and ran the following:
and the api key works:
However, when I use the exact same API key in postman (which I know works), I get the invalid user token message from above. |
Hmmm. Do you have '' around your API Key in the stack.env? Kinda grasping at straws, that's very odd. |
I tried it both ways (with and without ") and get the same error. |
Where are you running the curl command vs postman? Same computer? |
So turns out I'm a little dumb and forgot to update my env with the new API key I used in the curl command. Now that I did that and encased the key inside double quotes, the error goes away and it just says that a notification check was triggered. Unfortunately I still don't get a notification and a data.txt file isn't created still. No other errors are thrown though, so I'm not sure what exactly is failing. I did run the curl command from the same machine that immich and immich-notify docker containers are located. Postman is located on my windows machine though. Despite me not updating the env, postman still comes back with invalid token, but that could be a Windows firewall issue. |
I'm assuming it still didn't create the data.txt file? The first time it runs successfully it won't send a notification. |
Yeah, no data.txt file. I'm not sure I have the env and the compose file setup correctly for the data.txt file though (I posted both above). In my /immich-notify/ folder, I have a data folder and that is where I'd like the data.txt file to be created. In the compose file, should I just map the ./data/ folder to inside the container (as I have now), or should I include the specific data.txt file as well? Also in the .env, is that path for inside the container or outside? And should I have it as a relative path or full path, and should I include data.txt in that path or no? |
The volume should just be the folder, the env file should include the path and the file name. Here is how I have my Docker Compose setup
And my stack.env FILEPATH
In my case, the /mnt/data/appdata/immich_notification is a folder on my TrueNas server. You could probably simplify the internal folder structure but I keep it the same because I'm lazy and it works. |
well im thoroughly confused now. all i did was change the file path in the env and im back to the same error with the album:
one more time in case i messed up, heres my compose:
here is my env:
|
Well, in this case we're in the same boat. I updated it to run every 15 minutes and the docker container broke. I'm trying to figure out why its 50/50 when I build the docker container. I'll message when I get it fixed. Sorry for the inconvenience. EDIT |
All good, hopefully I can help you fix! |
Ok, latest container works for me. Should be back on track. -EDIT-
to stack.env to see more information in logs. |
Ok - making more progress. The container can see the album and can see the number of assets, but I'm getting an error about writing the file:
I then added another asset to the 'Test' album, and received the same error, and did not get a notification through ntfy. I'm assuming that's because of the file error.
When I log into the container, I can access the /data/ folder (mapped to /home/kevin/docker-apps/immich-notify/data/ on my docker host), where I have the data.txt file set to save. I can also create/edit/delete a test file within the container in the mapped directory above. |
That's interesting, I'll add some logging for the actual error with saving the file later today. In the meantime, can you try running
and see if that changes anything? |
thanks, happy to keep testing. i ran the chmod command and same issue:
|
@feerlessleadr dang, hoped that'd get it. Ok I added some logging for the IO errors. Let me know if that helps at all. |
Thanks - here is the error with the updated logging:
|
Hmm ok that didn't work like I thought it would. Updated again, please try again when you get a chance. |
thanks - just updated and got the following:
I then created the 'data.txt' file in the folder just in case the script doesn't create that file automatically:
I think made sure it is world writable:
However I'm still getting the same error that there is no such file or directory:
|
Could you try using the following as your docker-compose file? I think either the volume mapping order needs swapped or the FILEPATH variable needs to be /data/data.txt for your current setup, but the below should work either way.
|
I'm extremely happy to say that it's finally working for me. Thank you for your help and patience getting this to work, it's awesome that it opens up the website too when you click on the notification! |
Phew! Man I'm glad it's working. Thanks for your patience, obviously you're the first one to use it other than myself lol. Sorry for how long it took to get here. Hopefully made it more usable for anyone else now! Please let me know if you have any other issues or requests! Enjoy! |
Hi - I have ntfy setup in a separate docker container, however I have authentication setup. I mapped the main.py file outside of the container and tried to add in the basic auth to the main.py file:
However when I run the above, I get an error in the container that says:
Any idea how I can add in the auth to your script? Thanks
The text was updated successfully, but these errors were encountered: