useStream() requiring a secret as input #3788
-
langgraph/libs/sdk-js/src/react/stream.tsx Line 634 in 316f841 @dqbd , thanks for the great work! I was trying to leverage useStream() in a next js project. It is a client side component but requires apiKey as input. For me, apiKey is a secret that i prefer not exposed to browser. (In Next JS i struggle to have the useStream takes in apiKey from .env because its a client component) I did some research and seems it's recommended to have useStream() accept a fetcher as input, where the fetcher calls the server side to instantiate Client from Wondering if you know a better approach to leverage the useStream() while keeping the apiKey secured? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
How did you named variable in .env? |
Beta Was this translation helpful? Give feedback.
Custom auth for JS is on our roadmap, in the meantime you can use https://github.com/bracesproul/langgraph-nextjs-api-passthrough to act as a middleware between client and LangGraph API (cc @bracesproul)