Explorer
Get NFT Collections
Learn how to retrieve NFT collections using the Okto SDK.
The getNftCollections
function retrieves NFT collection details for the authenticated user from the backend.
Available on




To enable these chains for your application, please configure them in the Okto Dashboard.
Not available on

Example
using System;
using System.Threading.Tasks;
using UnityEngine;
//This is an independent script which calls GetNftPotfolio() Api
namespace OktoSDK
{
public class NFT : MonoBehaviour
{
public async Task<object> GetNftCollections(OktoClient oc)
{
if (oc == null)
{
ResponsePanel.SetResponse("You are not logged In!");
return "You are not logged In!";
}
if (!oc.IsLoggedIn())
{
ResponsePanel.SetResponse("You are not logged In!");
//ResponsePanel.DisplayResponse();
return "You are not logged In!";
}
try
{
var response = await BffClientRepository.GetBffClientRepository().GetPortfolioNft();
return response;
}
catch (Exception error)
{
Debug.LogError($"Error fetching NFT collections: {error}");
throw new Exception("Failed to fetch NFT collections from the backend.");
}
}
}
}
Note
For error handling:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support
Method Overview
Method | Description |
---|---|
async GetNftCollections | Get NFT collections for the user |
Get NFT Collections
async GetNftCollections(oktoClient: OktoClient)
retrieves the list of NFT collections associated with the user.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
oktoClient | OktoClient | Instance of OktoClient obtained from OktoClient.cs | Yes |
Response
Success Response
Field Name | Type | Description |
---|---|---|
collections | Task<List<NFTBalance>> | List of NFT collections |