Skip to main content
You can easily integrate with MoonKey login flow to provision or retrieve Ethereum wallet access. We keep track of all MoonKey provisioned wallets with the associated user and securely provide access to your users client-side.

1 - Install MoonKey.js

HTML

2 - Install Ethers.js

HTML

3 - Configure MoonKey SDK

We add the following code to initialize the MoonKey SDK.
Initialize
In this example, we will be using your PublicToken, which is publishable and safe to expose client-side.

4 - Handle Login

We create a simple login form to allow the user to enter their email and authenticate.
HTML
In the same script as the initialization, we just add click listener to handle the login button when clicked.
Login Click
Once the user types in the email and clicks the login button, a magic link will be sent to their email address. Since we enabled the the autoVerify setting by configuring autoVerify: true, which allows the user to verify magic link via a MoonKey hosted verification page.
Handle Login + Authentication
If you want to customize this verification page and brand it yourself, you can optionally configure redirect url that your user will redirect to and handle the magic token yourself. Read more about the different parameters and customizations you can do in our MoonKey SDK Docs.

5 - Perform Web3 functions

Now that you have the Web3 Provider inside the global variable streambirdProvider, you can perform different Web3 operations. Here are some examples:
Congrats! You now have allowed your user to access their own Ethereum wallet and you have the capability to perform many Web3 functions! To view a demo, please see navigate to the following example.