Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bearer token support #69

Open
theoden8 opened this issue Jun 28, 2024 · 2 comments
Open

bearer token support #69

theoden8 opened this issue Jun 28, 2024 · 2 comments

Comments

@theoden8
Copy link

theoden8 commented Jun 28, 2024

Good afternoon,

Would it be possible to ask for bearer token support to authorize with protected self-hosted ollama services?

The implementation detail is that the HTTP/HTTPS request needs to contain the following header field:

authorization: Bearer $token

Kind regards

@kevinhermawan
Copy link
Owner

Thanks for the suggestion! Let’s make it happen.

@gromer
Copy link

gromer commented Feb 25, 2025

Yeah, this would be nice. After poking around at the code, looks like an update to the underlying OllamaKit library would be needed to add the additional Authorization header support before Ollamac could actually send the token. Most likely at least changes to:

  1. OllamaKit library
    1. OllamaKit to add additional constructors to manage the additional param.
      1. Adding maybe init(baseURL: URL, bearerToken: String) and init(bearerToken: String)
    2. OKRouter to update the asURLRequest function to take in a bearerToken param to modify the request headers.
    3. All the callers of asURLRequest so include the bearer token, if set.

Then updates would be needed to Ollamac to provide the ability to set the bearer token and leverage it when set.

I haven't done much Swift, but may have time to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants