We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug In the sample code: https://firebase.google.com/docs/genkit/plugins/ollama#authentication it shows
export async function getIdToken(url: string): Promise<string> { const auth = getAuthClient(); const client = await auth.getIdTokenClient(url); return client.idTokenProvider.fetchIdToken(url); }
But client.idTokenProvider.fetchIdToken(url); is fetching a new ID token each time.
client.idTokenProvider.fetchIdToken(url);
Expected behavior
The sample code needs to check the exp date first, something similar to this (but in typescript)
const auth = new GoogleAuth(); const client = await auth.getIdTokenClient(url); async function fetchWithAuthHeader(url, options = {}) { const headers = await client.getRequestHeaders(url) options.headers = { ...headers, ...(options.headers || {}) }; return fetch(url, options); }
Then in the ollama plugin, instead of
requestHeaders: async (params) => ({ Authorization: `Bearer ${await getIdToken(params.serverAddress)}`, }),
use fetchWithAuthHeader instead.
fetchWithAuthHeader
The text was updated successfully, but these errors were encountered:
cabljac
Successfully merging a pull request may close this issue.
Describe the bug
In the sample code: https://firebase.google.com/docs/genkit/plugins/ollama#authentication it shows
But
client.idTokenProvider.fetchIdToken(url);
is fetching a new ID token each time.Expected behavior
The sample code needs to check the exp date first, something similar to this (but in typescript)
Then in the ollama plugin, instead of
use
fetchWithAuthHeader
instead.The text was updated successfully, but these errors were encountered: