Examples
Examples and code snippets to get you started.
Overview
Add a Verify with NFT or Verify with token button to your page with the code snippet above.
Create a backend endpoint to redirect users to after connecting with their wallet. The
redirect_urivalue in the snippet should be set to this URL.Once connected, users will be navigated to
<redirect_uri>?code=<authCode>. This endpoint should send aPOSTrequest tohttps://connect.inloop.to/api/v1/oauth/tokenwith JSON body{code: <authCode>}. Remember to set anAuthorization: Bearer <api_key>header.The response should be
{user_token: <userToken>}. Query the list of NFT or ERC-20 tokens owned by the user by sending aGETrequest tohttps://connect.inloop.to/api/v1/users/:user_token/tokens, replacing :user_token with the<userToken>. Make sure to specify the NFTs or tokens you are looking for in your InLoop Connect dashboard!The response should be a JSON structure like the one below. You're pretty much done! Now you can grant your users benefits associated with the tokens or NFTs they own.
Code Samples
See a complete, working repo with React.js and Express.js at https://github.com/inloop-to/inloop-example.
Client-side - React example:
Server-side - Node.js example:
Last updated