chat-ollama icon indicating copy to clipboard operation
chat-ollama copied to clipboard

How to use the protected URL with username and password as knowledge bases?

Open superdba111 opened this issue 10 months ago • 2 comments

We have some internal URLs and want to add them as knowledge bases, however, we cannot find the way to store the username and password, and we don't want to use https://username:password@hostname/path, please advise, thanks

superdba111 avatar Apr 17 '24 15:04 superdba111

If I understand correctly, your URLs are protected by basic authorization. Instead of embedding the user name and password in the URL, you could use Authorization header with base64 encoded credential. The encoding is a standard process.

If you use javascript, it can be worked out:

const username = 'username';
const password = 'password';
const credentials = `${username}:${password}`;
const encodedCredentials = Buffer.from(credentials).toString('base64');
const authHeader = `Basic ${encodedCredentials}`;

sugarforever avatar Apr 17 '24 16:04 sugarforever

If I understand correctly, your URLs are protected by basic authorization. Instead of embedding the user name and password in the URL, you could use Authorization header with base64 encoded credential. The encoding is a standard process.

If you use javascript, it can be worked out:

const username = 'username';
const password = 'password';
const credentials = `${username}:${password}`;
const encodedCredentials = Buffer.from(credentials).toString('base64');
const authHeader = `Basic ${encodedCredentials}`;

I believe @superdba111 expects that ChatOllama being able to load password protected webpages as knowledge base. Is it possible that ChatOllma pops up user/pwd prompt for user input, once it determines the given URL for KB is username/pwd protected, and bring the session cookie into recursive webpage embedding?

meokey avatar Apr 18 '24 01:04 meokey