Sign in + Tokengating

Allow existing Crossmint users to easily sign-in to your application using Wallet Connect or Crossmint Connect.

Using Crossmint Connect

Crossmint Connect is a focused, simple user experience for Crossmint wallet holders to sign in to applications. See demonstration video on the user experience for Crossmint Connect.

Get started by downloading our Crossmint Connect SDK from Github here

Using WalletConnect

If you’ve integrated WalletConnect in your application, Crossmint is a default option to sign in with your users. Crossmint wallets are compatible with both WalletConnect v1 and v2. See demonstration video on the user experience for WalletConnect.

Note that WalletConnect will not work if a wallet is created using the userID parameter in the create wallet API.

Tokengating

Token Gating enables developers an access point, which hinges upon the existence of a specific NFT within a user's digital wallet. Enabling developers to create an access-based environment, where particular content, experiences, or perks can be provided exclusively to the holders of certain NFTs. This can be in-person or digitally based.

Use Cases

  • Digital Content Access
    Can be used by content creators and platforms to allow special access to premium content for users who hold specific tokens – articles, videos, music, digital art, or any other form of digital content. The content is 'gated' behind the token, and only those who possess the token in their wallet can access it.

  • Membership Clubs and Virtual Gatherings
    Could be for members-only clubs or for special events like conferences, concerts, or parties in the Metaverse. Allows organizations to ensure that only token holders can participate in these exclusive gatherings, fostering a more intimate and engaged community experience.

  • Digital Assets and Gaming
    Create a dynamic in-game economy, where tokens can be traded, bought, or earned to unlock new experiences.

  • Real-life Experiences
    Token gating isn't limited to the digital world. Enterprises/businesses can provide exclusive access to real-world events or experiences for token holders. It provides you access to a concert, a sports event, a conference, or a special discount at a store.

Implementing Token Gating

Let’s walk through the steps of how you can implement Tokengating with different ways:

Using Crossmint's Fetch Wallet Contents API

  1. Adding Crossmint Connect Button to Your Website
    The first step is to incorporate Crossmint Connect's button into your website. This button, when clicked, will allow users to authenticate and connect their digital wallet with your application. It's essential to position this button in a location that ensures optimal visibility and ease of access for your users.
  2. User Authentication and Wallet Address Receipt
    Once the user clicks on the Crossmint Connect button, they will be asked to log in to their Crossmint account. Upon successful login, your website will receive the connected wallet address(es). This step establishes the critical link between your application and the user's digital wallet.
  3. Fetching NFTs using Crossmint’s Fetch Wallet Contents API
    After obtaining the user's wallet address, you can now interact with the Crossmint API to fetch the NFTs associated with the wallet. We provide a simple API for fetching the contents of a wallet. Here is an example of how to use the API with node-fetch:
const fetch = require('node-fetch');

const url = '<https://staging.crossmint.com/api/v1-alpha1/wallets/chain:wallet/nfts?page=xx&perPage=xx>';
const options = {
  method: 'GET',
  headers: {
    accept: 'application/json',
    'X-CLIENT-SECRET': '<YOUR_CLIENT_SECRET>',
    'X-PROJECT-ID': '<YOUR_PROJECT_ID>'
  }
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));

Replace <YOUR_CLIENT_SECRET> and <YOUR_PROJECT_ID> with your project's credentials.

  1. Verifying Presence of the NFT
    With the list of NFTs fetched from the user's wallet, the final step is to check whether the NFT required for your token gating feature is present in this list. If it is, then the user is granted access to the gated content or service.

Integrating with Other Tokengating Applications (TokenProof, EthPass).

We recommend using other Tokengating applications such as TokenProof or EthPass for IRL (in-real-life) use cases.

TokenProof: Users can download the Tokenproof app and connect their Crossmint wallet. As a developer, you need to download the verifier app to verify ownership of the asset.
EthPass: Details about integration with EthPass can be provided once available.

Troubleshooting

If you encounter issues while integrating with Crossmint, ensure that:

  • Your project credentials are correctly set.
  • Your user is correctly authenticated.
  • You have adequate error handling in your code to manage issues with API requests.