Moralis not authenticating in nextJS

I have a nextJS app using react-moralis. I am using the MoralisProvider and then calling the useMoralis hook to authenticate users. However when I call the authenticate function nothing happens. I can pass the onComplete argument with an alert and I get the specified alert or console.log but no popup allowing user authentication is shown.
This is a view of the onClick handler for my button:

did you also try onError or onSuccess?

No, I did not try it. But should I not be getting some kind of result? If I console log the returned value of authenticate I get “undefined”.

I just took your suggestion and logged the onError. I get this:
Error: Non ethereum enabled browser
at InjectedWeb3Connector.value (InjectedWeb3Connector.js?c181:137:1)
at InjectedWeb3Connector.eval (InjectedWeb3Connector.js?c181:150:1)
at tryCatch (runtime.js?c56e:63:16)
at Generator.invoke [as _invoke] (runtime.js?c56e:294:1)
at Generator.eval [as next] (runtime.js?c56e:119:1)
at asyncGeneratorStep (asyncToGenerator.js?4ec9:5:1)
at _next (asyncToGenerator.js?4ec9:27:1)
at eval (asyncToGenerator.js?4ec9:34:1)
at new Promise ()
at new Wrapper (export.js?db00:18:1)
at InjectedWeb3Connector.eval (asyncToGenerator.js?4ec9:23:1)
at InjectedWeb3Connector.eval (InjectedWeb3Connector.js?c181:184:1)
at InternalWeb3Provider.eval (InternalWeb3Provider.js?d168:146:1)
at tryCatch (runtime.js?c56e:63:16)
at Generator.invoke [as _invoke] (runtime.js?c56e:294:1)
at Generator.eval [as next] (runtime.js?c56e:119:1)
at asyncGeneratorStep (asyncToGenerator.js?4ec9:5:1)
at _next (asyncToGenerator.js?4ec9:27:1)
at eval (asyncToGenerator.js?4ec9:34:1)
at new Promise ()
at new Wrapper (export.js?db00:18:1)
at InternalWeb3Provider.eval (asyncToGenerator.js?4ec9:23:1)
at InternalWeb3Provider.eval (InternalWeb3Provider.js?d168:174:1)
at Function.eval (MoralisWeb3.js?22fb:377:1)
at tryCatch (runtime.js?c56e:63:16)
at Generator.invoke [as _invoke] (runtime.js?c56e:294:1)
at Generator.eval [as next] (runtime.js?c56e:119:1)
at asyncGeneratorStep (asyncToGenerator.js?4ec9:5:1)
at _next (asyncToGenerator.js?4ec9:27:1)
at eval (asyncToGenerator.js?4ec9:34:1)
at new Promise ()
at new Wrapper (export.js?db00:18:1)
at Function.eval (asyncToGenerator.js?4ec9:23:1)
at Function.eval (MoralisWeb3.js?22fb:437:1)
at Function.eval (MoralisWeb3.js?22fb:639:1)
at tryCatch (runtime.js?c56e:63:16)
at Generator.invoke [as _invoke] (runtime.js?c56e:294:1)
at Generator.eval [as next] (runtime.js?c56e:119:1)
at asyncGeneratorStep (asyncToGenerator.js?4ec9:5:1)
at _next (asyncToGenerator.js?4ec9:27:1)

it looks like metamask plugin has to be enabled

I know… but isn’t there a way for users to scan a QR code or something?
Not all users will have a metamask plugin.

you can do that with wallet connect, you will have to specify that authentication should work with walletconnect in that case by using a parameter specific to walletconect

Just like this:

await authenticate({onError: (err) => console.log(err), provider: 'walletconnect'})

Should that work without the extension? It doens’t appear to be working. Also thank you so much for your quick responses. I’m so grateful :slight_smile:

you could try to check in documentation
https://docs.moralis.io/moralis-dapp/users/web3-login/walletconnect#integrate-moralis-with-walletconnect

I don’t know the expected syntax for react/nextjs

you could try first with metamask if this is the first time you try to write an application