Need to send request on behalf of the login user

I am using nextjs for frontend and apolloclient for fetching graphlq on realm, How can I save the login user and use it on apolloclient for sending request like mutations or queries.

Hey Aaron, welcome to the forums! :wave:

We have a guide in the docs that covers how to use Apollo client to connect to Realm GraphQL from your react app. It’s not built specifically in Next.js but should get you most if not all of the way. There’s even a fully-functional codesandbox app (linked on the page) that you can check out.

1 Like

Yes thank you for replying. I just want to ask how can I assure that i sent my request on behalf of the authenticated user not the anonymous user base on the example in vercel nextjs with realm-web

I saw that the example here was only for the anonymous user https://github.com/vercel/next.js/tree/canary/examples/with-realm-web. I want to know how can I possibly make it for the login user.

Gotcha! Our web tutorial shows how to authenticate with other types of users - it’s pretty much the same but the tutorial code shows how to integrate it into a larger app with user sign in. If you don’t want to run through the whole tutorial, check out the GraphQL step and its corresponding code in the tutorial project.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.