Nextjs14 + t3-create + SIWE

Hi, I have a nextjs14 app created using t3-create. I am trying to implement sign in with ethereum. The public repo is here https://github.com/0xsamuel1/nextjs14-siwe. I'm using supabase for postgres db. I have two question: (i) In src/server/auth.ts, const nonce = await getCsrfToken(); doesn't produce a nonce consistent with await siwe.verify......, however const csrf = cookies().get("next-auth.csrf-token")?.value.split("|")[0]; works. Any ideas why this is the case? (ii) After signing in from (i), in src/server/api/trpc.ts, in protectedProcedure, ctx.session is null and so unable to access api.example.getSecretMessage. Is someone able to help with this?
1 Reply
Laplace | GMT +2
Laplace | GMT +2OP10mo ago
Figured the answer to (i). Need to do:
const nonce = await getCsrfToken({ req: { headers: req.headers } })
const nonce = await getCsrfToken({ req: { headers: req.headers } })
However, (ii) still exists.
Want results from more Discord servers?
Add your server