[SOLVED] Sign auth message for nextjs session

trying to set session in nextjs app

I’ve requested the message

const { address, chain, network } = req.body; await Moralis.start({ apiKey: process.env.MORALIS_API_KEY }); try { const message = await Moralis.Auth.requestMessage({ address, chain, network, ...config, }); res.status(200).json(message);

i get back

"localhost wants you to sign in with your Ethereum account:
0x6C5F8F9A48B26b20F708193aAe8665721D4C9408

enter your cafe, take a seat

URI: http://localhost:3000
Version: 1
Chain ID: 5
Nonce: 4HbyaYn6BBybXwXTG
Issued At: 2022-09-30T18:04:30.550Z"

now how do i sign this?
I used wagmi const signature = await signMessageAsync({ message });
before but took it out the application… is there moralis only solution?

this does not work

           const message = user_.get("authData").moralisEth.data;
           const signature = user_.get("authData").moralisEth.signature;
           const { url } = await signIn('credentials', { message, signature, redirect: false, callbackUrl: '/profile' });

throws and error when verifiying

 const { address, profileId, expirationTime } = (await Moralis.Auth.verify({ message, signature, network: 'evm' })).raw;

maybe this tutorial helps:

you can sign it with any method that works for you as long as it is a personal sign

only with wagmi… i removed wagmi… is uses alchemy as the provider

i just went with localstorage instead