Hi, I had this working a few months back by following this https://docs.moralis.com/authentication-api/evm/how-to-sign-in-with-metamask-angular. Now in mobile browser, it’s throwing this error:
core.mjs:7380 ERROR ProviderNotFoundError: Provider not found.
Version: @wagmi/[email protected]
at injected.js:71:23
at Generator.next ()
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:17:1)
at _ZoneDelegate.invoke (zone.js:369:28)
at Object.onInvoke (core.mjs:7227:33)
at _ZoneDelegate.invoke (zone.js:368:34)
at ZoneImpl.run (zone.js:111:43)
at zone.js:2538:40
at _ZoneDelegate.invokeTask (zone.js:402:33)
Here is the code snippet
import {
connect,
disconnect,
getAccount,
injected,
signMessage,
} from “@wagmi/core”;
import { http, createConfig } from “@wagmi/core”;
import { fraxtalTestnet, mainnet, sepolia } from “@wagmi/core/chains”;
import { metaMask } from ‘@wagmi/connectors’;
auth() {
return new Observable((observer) => {
(async() => {
const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
connectors: [metaMask({useDeeplink: true})],
});
const { isConnected } = getAccount(config);
const provider = await connect(config, { connector: injected() }); // enabling the web3 provider metamask
const userData = {
address: provider.accounts[0],
chain: provider.chainId,
};
observer.next({ user: userData });
observer.complete();
})
}