API not fetching data . please help

Hello

I am using he below code to connect to the fyers api and get data.

string clientID = “dsdsdsds-100”;

string secretKey = “sdsdssdsd”;

string redirectURI = “https://127.0.0.1/”;

Methods t = new Methods();

string access_token = “XXXXXXXXXXXXXXXXXXXXXXXXXXX”;

FyersClass fyersModel = FyersClass.Instance;

fyersModel.ClientId = clientID;

//t.generateAuthCode(fyersModel, clientID, secretKey, redirectURI);

fyersModel.GetGenerateCode(clientID, secretKey, redirectURI);

fyersModel.GetGenerateCode(clientID, secretKey, redirectURI);

//fyersModel.AccessToken = access_token;

ProfileModel profileModel = new ProfileModel();

t.GetProfile(fyersModel, profileModel);

string text = profileModel.Name;

List holdings = new List();

t.GetHoldings(fyersModel, holdings);

foreach (HoldingModel item in holdings)

{

string holdingName = item.Symbol;

}

public class Methods

{

public async void GetProfile(FyersClass profile, ProfileModel profileModel)

{

    Tuple<ProfileModel, JObject> ResponseTuple = await profile.GetProfile();            

    // The response is of tuple and Item1 will be the data and Item2 will be the error message

    Console.WriteLine(JsonConvert.SerializeObject(ResponseTuple));

    profileModel = ResponseTuple.Item1;

}

public async void GetHoldings(FyersClass profile, List<HoldingModel> holdings)

{

    Tuple<List<HoldingModel>, HoldingsOverAllModel, JObject> holdingTuple = await profile.GetHoldings();  

    holdings = holdingTuple.Item1;

}

public async void generateAuthCode(FyersClass fyersModel, string clientID, string secretKey, string redirectURI)

{           

    fyersModel.GetGenerateCode(clientID, secretKey, redirectURI);

}

}

Please help .

Regards,

Krishan Kaliraman

Hey @kumarkisna-2j3 ,

This error comes only when the access token is expired/invalid , could you please genreate a fresh token and check

Hey Abhishek ,

Is there any working code snippet to get the job done of authentication. I would appreciate if you share some example if there is one sitting in some webpage etc . It would speed up my effort to go beyond authentication.

I am using fyers C sharp library

Thanks

@WWhYB2qrsx can you share a working code in C#? which helps to pass through the authentication step. It is still not working for me.