Client-side: Does user have access to item
Client-side integration: Considerations and workflow for validating asset ownership
This workflow covers the different ways in which you can authenticate a player in order to check the assets that they have access to.
There are two sections to this guide:
- How to auth your user,
- How to validate that user has access/permissions to an asset (specifically an asset ID).
Part 1: Auth your user
Get your users to perform one of the following functions to authenticate:
Option 1: Continue as guest
A user continues as a guest, to which they have then created a User ID and a wallet.
They can receive assets but do not have full ownership of their wallet until they claim it, either by entering their email address or connecting a custodial wallet (at which point their account is upgraded from "guest" to "user").
Option 2: Create an account
Create an account by entering your email address and verifying.
This will create the User ID and wallet.
The user has full access and ownership of their wallet, and by giving their email they are able to re-auth.
Option 3: Log in
Enter your email and receive a login code.
Enter the code to auth.
You're now back in your previous Nefta User ID (NUID) and have access to your wallet.
Option 4: Connect an external wallet (account creation and log-in)
Instead of creating or logging in via email, a user can create an account and subsequently login thereafter by connecting a custodial wallet (Metamask).
Auth with access to custodial wallet.
Part 2: Get Owned Assets (specifically an asset ID)
Get all assets from the user:
Once authenticated, simply ping Get Gamer Owned Assets in our API reference.
This quite simply gets all the assets owned by a gamer whose token is sent as authentication.
The endpoint includes an asset_id for every asset they own.
Check against the asset ID you're expecting
You should have saved which asset ID you need to validate.
Simply check for a match between the returned results from the user and the asset ID you're looking for.
Updated 3 months ago