simulot / immich-go

An alternative to the immich-CLI command that doesn't depend on nodejs installation. It tries its best for importing google photos takeout archives.
GNU Affero General Public License v3.0
1.2k stars 36 forks source link

immich-go appears to retain/cache an API key #211

Closed drsib closed 3 months ago

drsib commented 3 months ago

I have 2 users in my installation. After uploading files to my admin user, i re-ran immich-go for a second user with that user's API key. All of the photos were uploaded to the admin user rather than the user owing the new API key

drsib commented 3 months ago

The code appears to reference a config file? Looks like its storing the API key there? Im not an expert by any means. I have tried rebooting the computer running immich-go and the server to see if there was a variable caching issue. It still appears to use the original API key

drsib commented 3 months ago

Found the config file in

C:\Users\XXX\.immich-go\immich-go.json

There is an API key stored there. The tool appears to read this API key even if a new one is provided in the arguments when the program is run. Not sure if that is expected behavior?

simulot commented 3 months ago

it is... The naive idea was to save the credential in that file. Doing so, the file could be used for getting the credentials. What behavior is expect for such file?

drsib commented 3 months ago

I like the idea of saving it. That way someone doesn't need to continue to provide it for future runs.

Maybe update the value in the config file if something new is provided when it is run again? That way it will remember what was last used but someone could easily change it.

A more complicated solution would be to build profile support where someone could switch, but that seems overkill.

Alternatively, you could just document that's how it works and how to change it if you want to use a different API key.