How to Add Custom Rally Login into an Ethereum Wallet Modal
Jennifer K. Tran
Posted on October 6, 2021
This article outlines how to add Rally.io login to Onboard.js, a modal integration that allows users to login into decentralized apps using various Ethereum wallets.
Since Rally is not an Ethereum Virtual Machine (EVM) compatible blockchain, developers must separate the Rally and Ethereum wallet authentications on their dapps.
However, Onboard.js simplifies the UI and allows dapps to easily add new Ethereum wallets and custom logins as user login options.
To learn more about the key differences between Rally and Ethereum, check out this article here.
Getting Started
Step 1: Set up Onboard.js (if you have not already)
You will need to add the Onboard.js as a package and initialize the library in your Javascript project.
You can follow the documentation to add Onboard.js to your project here.
As noted in the docs, to initialize the built-in wallet modules, you must pass an array of wallet initialization objects to the walletSelect.wallets parameter of the Onboard initialization object.
Step 2: Create a Rally.io login module
Create a new Javascript module. In the module, you will need to add the following:
An constant variable that stores the Rally starlight logo SVG:
const rallySVG = `<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{clip-path:url(#SVGID_2_);}
</style>
<g>
<path class="st0" d="M57.52,63.66"/>
<path class="st0" d="M72.92,35.95c0.33,0,0.6,0.27,0.6,0.6c0,14.02,8.64,24.87,25.39,25.22c0.33,0,0.6,0.27,0.6,0.6
s-0.27,0.6-0.6,0.6C82.15,63.3,73.51,74.15,73.51,88.17c0,0.33-0.27,0.6-0.6,0.6c-0.33,0-0.6-0.27-0.6-0.6
c0-14.02-8.64-24.87-25.39-25.22c-0.33,0-0.6-0.27-0.6-0.6s0.27-0.6,0.6-0.6c16.75-0.34,25.39-11.19,25.39-25.22
C72.32,36.22,72.59,35.95,72.92,35.95z"/>
<g>
<g>
<defs>
<path id="SVGID_1_" d="M46.93,62.96c16.75,0.34,25.39,11.19,25.39,25.22c0,0.33-0.27,0.6-0.6,0.6H1.1c-0.33,0-0.6-0.27-0.6-0.6
V11.83c0-0.33,0.27-0.6,0.6-0.6h45.78c13.96,0.29,25.44,11.29,25.44,25.32s-8.64,24.87-25.39,25.22c-0.33,0-0.6,0.27-0.6,0.6
S46.6,62.96,46.93,62.96z"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<g class="st1">
<g>
<defs>
<rect id="SVGID_3_" x="-4.5" y="6.23" width="81.82" height="87.54"/>
</defs>
<clipPath id="SVGID_4_">
<use xlink:href="#SVGID_3_" style="overflow:visible;"/>
</clipPath>
<g style="clip-path:url(#SVGID_4_);">
<image style="overflow:visible;" width="172" height="184" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEAlgCWAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
EAMCAwYAAAVcAAAHngAAC6L/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIALwArQMBIgACEQEDEQH/
xADPAAACAwEBAQAAAAAAAAAAAAACAwABBQYEBwEBAAIDAQAAAAAAAAAAAAAAAwECAAQFBhAAAwAB
AwMDAgYDAQAAAAAAAAECAxEEBRATBhI1JiAzMEAhIjIUIxUWJBEAAQEDBwgIBAQHAQAAAAAAAQIA
EQNAobESQ3MEECExQVEy0hNhcYGRwSKSM0JiIxQg0XLT8FKCorLCJAUSAAIBAQILBgQGAwAAAAAA
AAECAAMwESExYbESMpLSM3M0EEFxkdFyUSJSBKHB4fGyI0KiE//aAAwDAQACEQMRAAAA7Hl/JlaP
pd1vPEW10N8+cU3zwGUPdPDYZ7ZY7DLXPJZQtb04h4XSM5rQ3tTVgH09WSSc+b+D35/M9qViVEM1
nSjG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S
xraNb9Dm+r9rX11HO06+Xme1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1hO1h
Ox+w5PN+V1d2tz87sn//2Q==" transform="matrix(0.48 0 0 0.48 -4.8 5.76)">
</image>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>`
Create an export module that will direct the user to the callback that you stored the Rally.io login logic to.
Note: You will still need to add backend logic that will handle the Rally.io login. To learn more about how to set up Rally.io login, review the docs here or subscribe to my account for upcoming articles!
export const customRallyLogin = {
name: 'Rally', //display name of the wallet
preferred: true, //lists Rally login as a top login option
svg: rallySVG,
wallet: async helpers => {
window.location.href = 'yourcallback';
await new Promise(resolve => setTimeout(resolve, 10000));
return null;
},
desktop: true,
mobile: true
}
Step 3: Import the Rally Login module to Onboard.js
Import the Rally Login module into the Onboard initialization.
For example:
import { customRallyLogin } from "../../utils/logins/Rally";
Add the module name under the walletSelect.wallets parameter of the Onboard initialization object, alongside the other wallet integrations.
For example:
{ walletName: "metamask", preferred: true },
{ walletName: "torus", preferred: true },
{ walletName: "coinbase", preferred: true },
customRallyLogin
Step 4: End Result
Once you add the wallet model to an onClick method to a Login button, the Onboard.js module will popup and Rally is listed as a login option.
Posted on October 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.