Token Negotiator
  • Introduction
  • Quick Start
    • Getting Started with NFT's
    • Getting Started with Fungible Tokens
    • Getting Started with Off Chain Tokens
  • Learn
    • Installation
    • Supported Chains
    • Supported Wallets
    • Supported Attestations
    • Event Hooks
    • Issuer Configurations
      • Issuer Configuration EVM
      • Issuer Configuration Solana
      • Issuer Configuration Flow
      • Issuer Configuration Ultra
      • Issuer Configuration Socios
      • Issuer Configuration Off Chain
    • Active Negotiation (UI)
      • Custom Views
      • View Navigation
      • Theme
      • Configuration Options
    • Passive Negotiation (no UI)
      • Wallet Connection
    • Token Authentication
      • Off Chain Authentication
      • On Chain Token Authentication (evm)
    • Smart Contract and wallet Interaction
      • Sign message
    • Off Chain Token Issuers
  • Reference
  • Articles
  • Videos
  • Showcase
  • Contribution
  • Support
  • Migrating from version 2x to 3x
  • Github Examples
Powered by GitBook
On this page
  1. Learn
  2. Token Authentication

On Chain Token Authentication (evm)

Authenticating on chain tokens

The following solution utilises EVM Web3 Wallet Signature technology to sign a custom defined message which, once signed can be decoded to ensure the integrity of the wallet owner and the tokens they hold.

  1. Request signature:

const signature = await negotiator.web3WalletProvider.signMessage(
    walletAddress, 
    SigningMessage
)
  1. Define an array of tokens the user must hold as part of your authentication rules:

const claim =[{"smartContract":"0x94e22c14118353651636f9af43cd0a5a08b93da3","chain":"fantom","blockChain":"evm"}]

(include tokenids: [1,3,10] into the claim collection(s) when the user must have specific token(s))

  1. Verify the owner of the wallet an the claim of tokens they hold (use the following api server side to ensure the request and response is not manipulated by the end user (Client-side CSRF):

https://api.token-discovery.tokenscript.org/get-token-verification?claim=[{"smartContract":"0x94e22c14118353651636f9af43cd0a5a08b93da3","chain":"fantom","blockChain":"evm"}]&signature=0x4c8be3f2039b74e830c8febdd7d51df6db0d29e17845bec0b1f3cf8ec85579904d8b441144ddbac88fcea7b86fb03b16395aaeb2b254b836d800d45261db067d2c&message=hello-web3

PreviousOff Chain AuthenticationNextSmart Contract and wallet Interaction

Last updated 1 year ago