Discord NFT ownership verification 2.0

Flowtys
3 min readOct 7, 2021

--

Discord has become a de-facto communication platform for the NFT projects. It is no doubt the main tool to form a community around your project and of course you would want to give your holders benefit access to the closed Discord sections.

Now, the most common way we’ve seen so far is by using Collab.Land bot. While it is fine and easy to set up, but we found out several flaws which we thought worth trying to improve. In particular: relying on DM (most users have it turned off and Discord has strict limits so bots could encounter rate limit by Discord servers) and redirecting users to external, non-native to your project web page.

So, can we make it better and without using any 3rd party Bot? Let’s find out.

We are going to tackle the following points:

  1. Identifying Discord user (full guide from Discord here);
  2. Verifying NFT ownership front-end;
  3. Re-verify ownership and grant role on our serverless endpoint;

We would need to create a Discord Application first:

You also will need the Bot for granting user the Role at our last step.

Now we need to set the Redirect URL that would be our main web page, where we verify NFT ownership after the user has connected his Wallet. In our case that is https://club.flowtys.com:

Second is OAuth2 URL Generator, we need only Identity permission. Copy the URL response_type=code to response_type=token in that URL. Having that URL we can now post in into the channel:

Clicking the link would show standart Discord Authentication window:

And by clicking Authorize user will be redirected to specified page with access_token using which we can identify Discord user and show his avatar:

Now to the part of verifying NFT ownership. There’s numerous guide on how to handle wallet connection (you could use Web3Modal for example), so we will get to part an actual verification:

Having an array of actual Token IDs you could easily fetch your metadata if needed, e.g. https://<base_uri>/<Token ID>. Why would you need this? Well, one use case is to have closed clubs based on specific traits.

The last step is to ask the user to sign the simple text message:

We need this step if we want to ensure user owns our NFT before granting him the role on our serverless endpoint.

The final one is a serverless endpoint. You could probably suggest dozens of ways where to host this endpoint. What I personally found the easiest way is to use https://autocode.com/. It allows connecting to Discord in seconds and have a public-facing endpoint we need in no time.

After that your user should get the desired verified owner role! 🎉

This guide isby no means a perfect solution for a given use, but we always try to find a better way to make things better for our community ❤️.

Have some questions or suggestions: Drop a message on Twitter or join our Discord Fam to chat with us 💬.

--

--

Flowtys

Flowtys are 10k unique characters animated at 12 frames per second. All animation frames were carefully drawn by hand. First Aging NFTs.