SIWW
  • Sign-in with Wallet (SIWW)
  • Specifications
    • Abstract
    • Motivation
    • Open source libraries
    • Security considerations
  • Use Cases
    • NodeJS - Backend implementation
      • 1. Setup passport-wallet
      • 2. Connect to SIWW
      • 3. Manage your authentication token
      • 4. Add authentication routes
      • 5. Code the views
      • 6. Full sample app
      • 7. Debugging and Q&A
    • ReactJS - connect to backend
      • 1. Add a login route
      • 2. Redirect the route to your backend
    • JS - Native calls to SIWW libs
      • 1. Initialize SIWW client lib
      • 2. Connect to a Wallet
      • 3. Create a message
      • 4. Send a message
      • 5. React JS App
    • Authenticating as an end-user
      • 1. Have a wallet available
      • 2. Connecting and signing
Powered by GitBook
On this page
  1. Use Cases
  2. NodeJS - Backend implementation

5. Code the views

Previous4. Add authentication routesNext6. Full sample app

Last updated 2 years ago

Build a page, for example , which will contain the Sign With Wallet button and link any click on the button to the authentication route.

<!-- very basic sample home page -->
Hello Sign With Wallet World!
Could I get signed in ???
<br />

<a href="/auth/siww">
    <img src="../../assets/siww_button.png" style="width: 285px; height: 50px;"
    />
</a>

You can download the image below and insert it in your application. Note that the resolution is large (400x70px), so you may need to resize it to your need. See in the page example above, we resized to 285x50px

Then build another page for post-login, which will display the values returned by SIWW at authentication time. For example, we can code the dashboard.hbs page as per below.

<!-- very basic post-login page -->
Welcome user <b>{{param.username}}</b>!
<br />
You are logged-in!
<br />

Authenticated with 
<ul>
    <li>Connector: <b>{{param.connector}}</b></li>
    <li>Blockchain: <b>{{param.blockchain}}</b></li>
    <li>Wallet: <b>{{param.wallet_id}}</b></li>
    <li>Address: <b>{{param.wallet_address}}</b></li>
</ul>
<br />
Authorizations:
<ul>
{{#each param.authorizations}}
    <li>{{name}} - {{#if isValid}}TRUE{{else}}FALSE{{/if}}</li>
{{/each}}
</ul>

<br />

<a href="/auth/logout">
    <button 
        class="signin-btn btn social-btn btn-primary"
        style="background-color: #28c4cc;" 
        tabindex="5"
    >
        Logout
    </button>
</a>
Official Sign with Wallet button