Javascript
You can easily integrate with Streambird login flow to provision or retrieve Ethereum wallet access. We keep track of all Streambird provisioned wallets with the associated user and securely provide access to your users client-side
.
1 - Install Streambird.js
2 - Install Ethers.js
3 - Configure Streambird SDK
We add the following code to initialize the Streambird SDK.
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.
In the same script as the initialization, we just add click listener to handle the login button when clicked.
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 Streambird hosted verification page.
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 Streambird 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.