I am trying to use NextJS 13 Route Middleware to check for Metamask authenticated Users using Wagmi Package. But since wagmi works on client side. I am unable to achieve that in middleware. I tried using "use client" on the top of the middleware.ts. But it doesn't seem to work
#Using Nextjs 13 Route Middleware in Client Side
13 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>
✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
(if you don't see the option, try refreshing Discord with Ctrl + R)
I guess you have to wrap your app using a wrapper with use client and check that in there
that's how web3 works. middleware is supposed to run on Edge Runtime, which is not related to ReactJS, just a light weight Node.js with no cold start time.
create a client component which returns null and in useEffect of that do whatever you want with wagmi
you can do it via siwe and next-auth, or you can do what phantom said and have it set a cookie or redirect etc
or NFT token
would have been good if we could've used routes middleware as client component 🥲
react hooks are easier