private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

User Auth feature

Open BBjie opened this issue 1 year ago • 6 comments

I have seen they are auth.py file and auth settings in settings.yaml file, I'm assuming the auth feature is enabled in this project. Is there any guidance/documentation I can refer to to achieve it?

setting.yaml

server:
  env_name: ${APP_ENV:prod}
  port: ${PORT:8001}
  cors:
    enabled: false
    allow_origins: ["*"]
    allow_methods: ["*"]
    allow_headers: ["*"]
  auth:
    enabled: true
    # python -c 'import base64; print("Basic " + base64.b64encode("secret:key".encode()).decode())'
    # 'secret' is the username and 'key' is the password for basic auth by default
    # If the auth is enabled, this value must be set in the "Authorization" header of the request.
    secret: "Basic c2VjcmV0OmtleQ=="

BBjie avatar Apr 30 '24 19:04 BBjie

Same question here

Kraego avatar May 16 '24 13:05 Kraego

Any one knew how this works, I have spent hours to work on this, still couldn't figure out how to have a simple password on the UI.

vk4hdi avatar Jun 14 '24 08:06 vk4hdi

I will try to explain how it works by default. Once you enable auth.enable=True, the system validates if a basic authentication is included. By default the Authorization header is: Authorization: Basic c2VjcmV0OmtleQ==. I attach an example using cURL:

curl http://localhost:8001/v1/chat/completions
-H "Content-Type: application/json" 
-H "Authorization: Basic c2VjcmV0OmtleQ=="
-d '{
    "messages": [
      {
        "role": "system",
        "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."
      },
      {
        "role": "user",
        "content": "Compose a poem that explains the concept of recursion in programming."
      }
    ]
  }'

jaluma avatar Jul 10 '24 11:07 jaluma

Hi Jaluma

Thanks for the reply, however we want to have the authentication on the web interface, when a user typed: http://localhost:8081/ a authentication will pop up.

Thanks

vk4hdi avatar Jul 10 '24 13:07 vk4hdi

Did you find a solution meanwhile? Facing the same problem...

phimue1 avatar Sep 19 '24 06:09 phimue1

I reopened the issue and convert it to improvement. Currently, we consider gradio as testing ui, not the final one. Please consider use other alternatives or define a custom version yourself. In documentation, we have a react application without this issue: https://docs.privategpt.dev/manual/user-interface/alternatives

jaluma avatar Sep 23 '24 07:09 jaluma