WordPress Web3 Authentication Token Gating

  • Token Gating refers to restricting access to certain websites, services or applications based on the ownership of a token. In this case, Token Gating specifically refers to ownership of NFTs and the subsequent restriction or access of websites relevant to these NFTs.

  • When a user attempts to access a token gated page and connects it to a crypto wallet to do so, he will be redirected to the appropriate page based on the NFTs owned by the user.

  • If the user has those exclusive NFTs, he can access the page; otherwise, he is redirected to the error url entered by the admin.

Step:1 Configure the NFTs

  • Open the Contract Address Config tab and click on Add Token Details button.

wordpress-web3-single-sign-on

  • Enter valid details for NFTs you want to configure (Refer the below table).

    Contract Address Name Add a relevant name
    Contract Address Enter the Contract Address of NFT Collection
    No.of Tokens Enter the minimum number of tokens the end user should hold.
    Token Ids (Optional) Enter specific Token Ids that user should have
    Blockchain Choose appropriate blockchain for the NFT to be configured.

    wordpress-web3-single-sign-on

  • When NFT Configurations are saved, they are added to the list on the Contract Address Config tab.

    wordpress-web3-single-sign-on

Step:2 Add NFT Content Restriction

  • Go to NFT Content Restriction tab and click on Add Content Gating Details button.

    wordpress-web3-single-sign-on

  • Enter Appropriate details in the form (Refer the below table).

    Page URL Regex Choose the page to which you want to add Token Gating.
    Contract Address Name Choose the appropriate Contract Address from the dropdown menu configs
    Error URL Add Error URL for users who do not have the necessary exclusive NFTs to access the content.
  • Below is an Example of Configuring an NFT Token Gating on a wordpress page :

    1. In the Add Content Gating Details Modal, choose the page you wish to add token gating to. Below I have selected TestPage1.

    wordpress-web3-single-sign-on

    1. Select the Contract address that users will need to access the restricted . You can also choose more than one Contract Address.

      wordpress-web3-single-sign-on

    2. Choose the error page to which the user should be redirected if they don't have those NFTs, here is the error page that I selected. In the Add Content Gating Modal, enter the URL of the chosen error page.

      wordpress-web3-single-sign-on

    You can include the NFT Collection page as an Error URL so that users are redirected to purchase NFT in order to access the gated content.

    1. Click on Add to Save the Details.

      wordpress-web3-single-sign-on

    2. New row gets added to the NFT Content Restriction tab.

      wordpress-web3-single-sign-on

    3. Also, you can get Test Configurations for a particular wallet address in order to check if they have access to the pages gated.

Step:2 Test Configuration

  • Click on Test Configuration button and enter the wallet address for which you want to test.

    wordpress-web3-single-sign-on

  • Click on Submit button .

    wordpress-web3-single-sign-on

  • You can see the Test Configuration Result tor the entered wallet address .

    wordpress-web3-single-sign-on