Integrate Web Component
Sign Partners Agreement
Go to the partners portal.
Select the market that fits best your platform.
Customize your community name, description, avatar, roles, and expected Commitment Level
Click Sign and Deploy!
Copy your partner's key to use when integrating the web component.
Customize your own SkillWallet to activate your community.
Web Component - what it does
This Web Component is SkillWallet's decentralized, role-based authentication system. It lets your users create an account, or login to your platform, in a fully decentralized way, while giving them a familiar (web2-like) experience. Each user will add their nickname and avatar, and pick a Role in your Community - after doing that, they will join your community, and claim their universal ID.
Web Component Developer notes
When a user successfully logs in their SkillWallet information is stored in the 'Session Storage' with the Key 'skillWallet'.
Pre-requisite: obtain your Partner's Key
This Web Component is cross-platform, and can be integrated on any Web framework. In order to use it, though, you will need to have a Partner's Key - you can get deploy your role-based community on the Blockchain, and receive your Partner's Key directly on our Partners Dapp.
Web Component installation
React App
Install the library
npm i @skill-wallet/auth --save
Import the initialization function in the App.js/tsx (or index.js/tsx)
import { InitSwAuth } from '@skill-wallet/auth';
Call the InitSwAuth function at the start of your project
InitSwAuth();
Add the custom HTML tag and populate the partner-key property
Example
Angular
Install the library
npm i @skill-wallet/auth --save
Import the initialization function in the app.component.ts
import { InitSwAuth } from '@skill-wallet/auth';
Call the InitSwAuth function inside ngOnInit
ngOnInit(): void { InitSwAuth(); }
Add the CUSTOM_ELEMENTS_SCHEMA in your app.module.ts
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
Add the custom HTML tag and populate the partner-key property
Example
app.component.ts:
app.module.ts:
app.component.ts:
Vue
Install the library
npm i @skill-wallet/auth --save
Import the initialization function in the App.vue
import { InitSwAuth } from '@skill-wallet/auth';
Call the InitSwAuth function at the start of your project
InitSwAuth();
Add the custom HTML tag and populate the partner-key property
Example
App.vue:
Override button styles:
You can override all the styles of the button and the dropdown by providing CSSObjects to the InitSwAuth function.
Here's the default button style as an override:
The optional dropdown (use-button-options) styles can also be overriden in the same way:
NOTE:
Sometimes in order to achieve your desired style you might need to override Mui styles. You can see which styles you need to override by inspecting the web component and it's elements in your browser Developer Tools.
Web Component Custom HTML element attributes:
partner-key
The key you are given after signing a Partner's Agreementuse-dev
Set to 'true' to use the 'Mumbai' TestNetuse-button-options
If set to 'true' a dropdown will pop up when hovering over the Button. Currently, the only option is 'Logout'.
Web Component Helpful window events:
onSkillwalletLogin
Dispatched when the user has 'Logged in'. This means that their skillWallet has been successfully retrieved and stored in the session storage (key is skillWallet).onSkillWalletActivated
Dispatched when a SkillWallet is successfully activated. This happens after the QR Code is scanned from the mobile app.initSkillwalletAuth
Dispatched after initialization - signifies that the web component has read the partner-key and is ready to use.
Congrats! π
That's it! πππ
Your users can now create their SkillWallets and log in directly in your platform!
Last updated