Open ethan-auroria opened 9 months ago
Here is an update, if I use watchWalletClient
to listen for the wallet event, and call Web3ModalSIWEClient.signIn
if there is a valid, it does work. So perhaps it is the way to go.
I'm noticing different behaviour between MetaMask and Coinbase browser extensions. MetaMask works as expected, where it will not trigger SIWE sign in if there is a correct session. Coinbase however triggers the SIWE sign in dialog every time the page is reloaded, even if the session is valid.
I'm noticing different behaviour between MetaMask and Coinbase browser extensions. MetaMask works as expected, where it will not trigger SIWE sign in if there is a correct session. Coinbase however triggers the SIWE sign in dialog every time the page is reloaded, even if the session is valid.
Having same issue here, but with metamask, I provide a valid session data {address, chainId} but nothing happens
@Sam-Newman could you create a ticket for this one? Tagging so I don't forget.
Is there a ticket for this one? I am considering a contribution, because I got a case where this would be the best way.
If anyone finds this and is also having difficulty this is my current solution following this documentation: Edit: it works for Next js.
https://docs.walletconnect.com/appkit/next/core/siwe#getaddressfrommessage
Make sure to set the callbackURL to an existing route:
import { SIWEController } from '@web3modal/siwe';
return (
<a onClick={ async () => {await SIWEController.signIn()}} className="inline-flex justify-center items-center py-3 px-5 text-base font-medium text-center text-black rounded-full bg-primary-200 hover:bg-primary-300 hover:text-white">
Login
</a>
)
What problem does this new feature solve?
I have integrated a SIWE flow according to the documentation and found the following problem:
When I say SIWE flow breaks, it means that the next time user visit the page the w3m-button will appear as wallet is connected (it is not wrong) but it will not ask the user to sign the SIWE message.
Describe the solution you'd like
There are 2 possible solutions to this:
SIWEClientMethods.getSession
.Web3ModalSIWEClient.signIn
function, however because the user has not signed the message, the session is empty (no address, no chainId).