0.0.8 • Published 1 year ago

web3-for-auth0-actions v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

NPM Package

Web3ForAuth0Actions

Brought to you by the Lunar Foundation. https://lunar.io

A library for web3 functionality that can be leveraged in Auth0 Actions. Requires Sign In With Ethereum (SIWE).

Getting Started

  1. Open your Auth0 management console and navigate to 'Actions | Library' in the left-hand sidebar.
  2. Click "Build Custom" in the header.
    • Select "Login / Post Login".
    • Select "Node 16" for the Runtime.
    • Click the "Create" button.
  3. Click on the "Dependencies" icon in the grey editor (the box icon).
    • Type "web3-for-auth0-actions" in the textbox and click "Create".
  4. Paste in the following code :
exports.onExecutePostLogin = async (event, api) => {

  // SHEPARD: If you have other apps that don't use this Action, exclude those from execution via Rules or Actions.
  if (event.client.client_id !== 'YOUR APP ID HERE') return;

  const { Web3ForAuth0Actions } = require("web3-for-auth0-actions");
  const ContractAddress = "YOUR CONTRACT ADDRESS HERE";

  Web3ForAuth0Actions.DebugMode = true;
  // SHEPARD: Chain Id '56' is the BNB Chain Mainnet. 
  let [isValidReturn, returnMessage] = await Web3ForAuth0Actions.validateWalletBalance(event, 56, 1, ContractAddress);
  console.log(`IsValidReturn: ${isValidReturn}`);
  console.log(`ReturnMessage: ${returnMessage}`);
  
  // SHEPARD: Bounce anyone that doesn't have the minimum balance in their wallet.
  if (!isValidReturn) {
    api.access.deny(returnMessage);
  }
};
  1. Click "Deploy" in the top right-hand corner.
  2. Click "Flows" under "Actions" in the left-hand side bar.
  3. Click "Login".
  4. On the right-hand side, under "Add Action", select "Custom".
  5. Drag your new Action into the Flow area.
  6. Click "Apply"
  7. Profit!!!

You now have some functioning badassery!

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago