[SOLVED] Moralis Auth - NextJS - Walletconnect - Mobile browser - Local environment

Here is a small step by step on how to setup a dev environment for mobile device to test the NextJS WalletConnect Auth Moralis tutorial

  1. Follow Moralis tutorial for auth https://docs.moralis.io/docs/sign-in-with-walletconnect

  2. Update NEXTAUTH_URL in .env.local to your localhost public ip (ie: https://192.168.1.x:3000). Make sure your machine is accessible through local network. Try to access dapp from mobile browser using local ip + port

  3. Follow this tutorial to enable SSL on localhost BUT instead of ‘localhost’, create a certificate for your local dev machine ip (ie: 192.168.1.xx)
    https://medium.com/@greg.farrow1/nextjs-https-for-a-local-dev-server-98bb441eabd7

  4. Add NODE_TLS_REJECT_UNAUTHORIZED=0 in .env.local to bypass security warning about self signed certificates

  5. Launch app with “npm run start”. Now you can access the dapp from your mobile device through https://192.168.1.xx:3000.

When WalletConnect popup appears it gives options to select which wallet to use, select your choice and press option “Always use”!!! This is important as it will activate later a small popup that invite the signing step AFTER connecting dapp to wallet.

After cleaning cache and disconnecting wallet from dapp I could complete login + signing and got redirected to /user url successfully.

Hey clembcn,
Closing this here, as this continued on discord.

1 Like