SimpleID is available in a Javascript SDK. It can be installed through npm like so:
npm install simpleid-js-sdk
SimpleID is currently in beta release, so there may be bugs. These bugs should not impact your app.
Before moving on, make sure you have signed up and created a new project (app) here.
Once installed, you'll need to instantiate SimpleID in your app. That's as simple as dropping the following code in:
import SimpleID from 'simpleid-js-sdk';​const simple = new SimpleID({appOrigin: window.location.origin,appName: "App Name",appId: "YOUR-APP-ID",chatAddress: "YOUR-LIVE-CHAT-ADDRESS",renderNotifications: true});
Note that you should instantiate the SimpleID SDK at the highest level of your page to ensure it is persisted.
The parameters you pass into the SimpleID class are as follows:
Parameter | Purpose |
appOrigin | Tells us your application's URL |
appName | Tells us your application's name |
appId | Unique identifier for your project. You will get your appId after you've signed up for SimpleID here and created your first project. |
chatAddress | This is a unique address tied to your live chat support module. It is found on the projects page with your appId. |
renderNotifications | If true, will build a notifications widget and display the right notifications for the right users. If false, the notification data will be returned and can be used to display notifications however you'd like. |
A note on chatAddress - If the address is provided, the real-time chat widget will be displayed. If it is not provided, no real-time chat widget will be displayed.
SimpleID supports any wallet provider, you will simply need to make sure you pass through, at very least, their wallet address, but you can pass through their email as well. Here's how:
const userInfo = {email, //optionaladdress,provider //optional}simple.passUserInfo(userInfo);
The parameters you pass into this method are defined as follows:
Parameter | Required | Purpose |
No | If the email is available, it will be passed into our disassociation service and can be used for email communication through the SimpleID platform. | |
address | Yes | This is the user's wallet address. |
provider | No | This is the wallet provider the user is using. This parameter can help with segmenting users in the future. |
The simple.passUserInfo()
method should be called when a user first visits and signs into your application.
Note - Local storage is used to ensure ready availability of session data. So if your application users switch wallet addresses in the middle of a session, you will need to catch that and call the simple.signOut()
method followed by the simple.passUserInfo()
method again with the new wallet info.
Method | Parameters | Purpose | Result |
passUserInfo() | email, address, provider[Object] | Allows the necessary information for the SimpleID platform to be passed through for users not using the SimpleID wallet | User session returned |
signOut() | None | Signs a user out, clearing session data. | Removes all session data |
notifications() | None | Returns available notifications for a user. | Available notifications |
If there's something you're curious about, don't hesitate to reach out to us via email, Discord, or Telegram.