Theo's Typesafe CultTTC
Theo's Typesafe Cult2y ago
2 replies
Laplace

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?
Was this page helpful?