A couple months back, the awesome team at Metamask put up a blog post (https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) stating that from Nov 2nd onwards, Metamask will be updated to stop having Web3 exposing user accounts by default; Rather, would require the dApp to explicitly request for permission to access Metamask accounts.
Presently, “Privacy Mode” when rolled out, will still be disabled by default; It will, however, be eventually enabled by default on a future release.
So let’s have a look to see how this looks like.
Cooking up a quick test right here to retrieve Metamask’s first account with my current install of Metamask.
All fine and dandy. Now we will install the custom Metamask build found here, and turn on Privacy Mode:
Now that we see Privacy Mode does indeed prevent us from accessing Metamask directly, let us add in the codes required to enable the provider:
Refresh our test, and we should see a prompt:
The setting selected will be remembered by Metamask, and could be cleared by clicking on “Clear Privacy Data” found right above the option to enable “Privacy Mode”
And that’s it! Pretty straightforward. Huge shout out to team Metamask for making this much required change — Oh, and looking forward to seeing the Metamask mobile client soon as announced at DevCon4! ;)