ai-traders / liget

NuGet server and cache running on kestrel in docker
MIT License
216 stars 29 forks source link

push error 401 (Unauthorized) #22

Open lpyedge opened 4 years ago

lpyedge commented 4 years ago

dotnet nuget push CouchbaseNetClient.2.7.4.1.nupkg --source http://192.168.0.11:9011/api/v3/index.json --api-key xxxxxxx info : 正在将 CouchbaseNetClient.2.7.4.1.nupkg 推送到 'http://192.168.0.11:9011/api/v2/package'... info : PUT http://192.168.0.11:9011/api/v2/package/ info : Unauthorized http://192.168.0.11:9011/api/v2/package/ 255 毫秒 error: Response status code does not indicate success: 401 (Unauthorized).

lpyedge commented 4 years ago

why it ask me input username & password??

ljsnogard commented 4 years ago

Encountered the same error as above.

Steps to reproduce:

  1. Generate API key hash.

    $ echo -n 'AB' | sha256sum
    38164fbd17603d73f696b8b4d72664d735bb6a7c88577687fd2ae33fd6964153  -
  2. Launch.

    $ LIGET_API_KEY_HASH=38164fbd17603d73f696b8b4d72664d735bb6a7c88577687fd2ae33fd6964153 docker run -d -ti -p 9011:9011 tomzo/liget:1.0.3
    bf886e9a61ded7c8cb8647d7e28d4c651399474567936c27a71cd91e93afa391
  3. Push package.

    
    $ dotnet nuget push myXxxPackage.nupkg --source http://xxxxx:9011/api/v3/index.json --api-key AB 

info : Pushing myXxxPackage.nupkg to 'http://xxxxx:9011/api/v2/package'... info : PUT http://xxxxx:9011/api/v2/package/ info : Unauthorized http://xxxxx:9011/api/v2/package/ 737ms error: Response status code does not indicate success: 401 (Unauthorized).

jsiedentop commented 4 years ago

I have the same problem. Didn't get it to work.

rasputino commented 4 years ago

The LIGET_API_KEY_HASH should be set in the container. Something like this:

docker run -d --name=liget --mount source=datasimple2,destination=/data/simple2 --mount source=datasqlite,destination=/data/ef.sqlite --mount=source=cachesimple2,destination=/cache/simple2 -ti -p 9011:9011 -e LIGET_API_KEY_HASH='a43d9da1b01b33e1ee917af34006ad529890f13a3a5ad88a0dxxxxxxxxxxxxxx' tomzo/liget

gluckez commented 2 years ago

Is this just not working and no longer maintained? this issue has been open since 2020, and I'm having the exact same problem

timrabl commented 2 years ago

Is this just not working and no longer maintained? this issue has been open since 2020, and I'm having the exact same problem

@gluckez Authorization is working as intended, just generate ur hash with:

echo -n <UR PASSWORD HERE> | sha256sum | awk '{print toupper($1)}'

Afterwards set ur environment variable via the command mentioned by @rasputino or use the following

docker run -d -v data:/data/simple2 -v db:/data/ef.sqlite -v cache:/cache/simple2 -p 9011:9011 -e LIGET_API_KEY_HASH=<UR HASH HERE> tomzo/liget:1.0.3