krita-ai-diffusion icon indicating copy to clipboard operation
krita-ai-diffusion copied to clipboard

[Feature request] Add bearer token to custom server mode

Open short-circuit opened this issue 1 year ago • 2 comments

I am running my ComfyUI instance behind reverse proxy and a custom API endpoint authentication. This will 1:1 forward all API calls when done with the correct bearer token. Can we have a setting to set up a bearer token to the API calls in custom server mode?

short-circuit avatar Jun 10 '24 20:06 short-circuit

Maybe you can try, comfy_client.py, just add bearer="your token" argument to the get & post calls.

    # example for post
    return await self._requests.post(f"{self.url}/{op}", data, bearer="1234")

Acly avatar Jun 13 '24 13:06 Acly

I was able to make some calls with bearer token and post and get, but only after setting the access_token at the websocket client connect (otherwise it would not connect to the server at all): https://github.com/Acly/krita-ai-diffusion/blob/47fa1abcd7ed37000c4577f5a1f384467e8ca6a5/ai_diffusion/comfy_client.py#L72 I will try to correctly implement it (GUI settings and all) and in case make a PR when I have the time

short-circuit avatar Jun 14 '24 08:06 short-circuit