How can I configure and login get Request Token in Asp.core WebApi

wpsandeep
Please help us. we are trying to configure but every time get an error Invalid or Expire Request Token.
We are using this example:
Kite kite = new Kite(MyAPIKey, Debug: true);

// Collect login url to authenticate user. Load this URL in browser or WebView.
// After successful authentication this will redirect to your redirect url with request token.
kite.GetLoginURL();

// Collect tokens and user details using the request token
User user = kite.GenerateSession(RequestToken, MySecret);

// Persist these tokens in database or settings
string MyAccessToken = user.AccessToken;
string MyPublicToken = user.PublicToken;

// Initialize Kite APIs with access token
kite.SetAccessToken(MyAccessToken);

// Set session expiry callback. Method can be separate function also.
kite.SetSessionExpiryHook(() => Console.WriteLine("Need to login again"));

// Example call for functions like "PlaceOrder" that returns Dictionary
Dictionary response = kite.PlaceOrder(
Exchange: Constants.EXCHANGE_CDS,
TradingSymbol: "USDINR17AUGFUT",
TransactionType: Constants.TRANSACTION_TYPE_SELL,
Quantity: 1,
Price: 64.0000m,
OrderType: Constants.ORDER_TYPE_MARKET,
Product: Constants.PRODUCT_MIS
);
Console.WriteLine("Order Id: " + response["data"]["order_id"]);

// Example call for functions like "GetHoldings" that returns a data structure
List holdings = kite.GetHoldings();
Console.WriteLine(holdings[0].AveragePrice);
Sign In or Register to comment.