GuilleOriginal post
Moderator
Hey, how should I work with the two SDK
I'm using Nextjs so al the authentication process is made with the node-sdk but there are some queries to the database I need to do with the client SDK
Currently I'm doing:
TypeScript
const sessionClient = () => { const session = getCookie(SESSION_COOKIE_TOKEN); return new Client() .setEndpoint(Server.endpoint || "") .setProject(Server.project || "") .setSession(session || "");}
const client = sessionClient();const databases = new Databases(client)However when I do a request I got an error 401
When I see the the request headers I see the session token (see the image), what I'm doing wrong?
Summary
The developer is trying to work with both client and server SDKs in a Next.js project. They are using the `node-sdk` for authentication and the client SDK for database queries. They are experiencing a `401` error even though the session token is present in the request headers. There may be an issue with the way the session token is being set or passed.
**Solution:**
- Double-check the session token generation and ensure it is correctly passed to the client SDK.
- Make sure the server SDK and client SDK configurations are properly set up.
- Debug the authentication flow to identify any issues in the session establishment process.