How to connect to infura direct if user has metamask but isn't logged in? (using Drizzle)

I understand how to connect direct to infura if the user has no wallet at all (for displaying blockchain data when users don’t have a wallet) the problem is that I don’t know how to connect to infura when users have Metamask installed, but not logged in or connected.

Drizzle is default to MM (if installed) and requires them to connect.

I want to use infura as default for everyone, UNLESS they press the connect button -> then I want to switch to MM.

I’ve tried to change the web3 provider on the fly in window.web3 - didn’t work

I’ve tried to put infura in drizzleOptions as a custom provider - didn’t work

I’ve tried to use different drizzleOptions files for each case - didn’t work

What am I missing?

Hey @mcplums, it sounds like a fallback provider is what you’re looking for, which is in their docs here:

Infura would be the fallback (default) unless metamask is injected. Let us know if that works for you!

Hey @mcplums,

Can you clarify what didn't work means?

I may be misunderstanding your question but It sounds like you want your dapp to connect blockchain if MM’s provider hasn’t been enabled or has timed out. This isn’t currently solvable through fallback and customProvider. It is an interesting use case and would appreciate if you open an issue against Drizzle so we can work it.

By any chance were you in CA’s recent cohort?

@cds-amal sorry for the late reply here. The issue was actually communicated to me by my front end dev, I will ask him to elaborate.