![]() ![]() Sign messages with the private key of the current account ( ).Check the current active account on MetaMask ( ).Web3.js is a JavaScript interface to the Ethereum blockchain. MetaMask also injects a global API at window.ethereum and the private MetaMask API private key can be exported from the browser extension via the Account Details button. To have a look at what this object looks like, just type window.web3 in the Chrome or Firefox DevTools console, if you have MetaMask installed. Once injected, a web3 object will be available via window.web3 in the JavaScript code of this website. It does so by injecting a JavaScript library called web3.js in every webpage you visit. ![]() As a browser extension, it can interact with the current webpage you’re browsing. At its core, it serves as an Ethereum wallet: By installing it, you will get access to a unique Ethereum public address, with which you can start sending and receiving ether or tokens.īut the MetaMask wallet does something more than a typical Ethereum wallet. MetaMask is a browser plugin, available as the MetaMask Chrome extension or Firefox Add-on. ![]() If you already know what MetaMask is, feel free to skip this section. That being said, with MetaMask becoming such a popular extension, now seems a good time to introduce this login flow. Please note that while we will be using tools connected to the Ethereum blockchain (MetaMask, Ethereum public addresses), this login process does not actually need the blockchain: It only needs its cryptography functions. If it doesn’t seem clear, that’s all right, because our MetaMask tutorial will explain it bit-by-bit: Therefore, we can build a message-signing-based authentication mechanism with a user’s public address as their identifier. If you manage to sign a precise piece of data generated by our back end, then the back end will consider you the owner of that public address. The basic idea is that it’s cryptographically easy to prove the ownership of an account by signing a piece of data using a private key. Looks good? Let’s get started! How to Use Metamask Authentication for a One-Click Login Flow ![]() We call it: “Login with MetaMask”.Ī picture being worth a thousand words, here is a demo of the login flow we are going to build: This article introduces a new login method to blockchain development: A one-click, cryptographically-secure login flow using the MetaMask extension, with all data stored on our own back end. For example, at the time of writing, Facebook is facing data privacy issues.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |