request token Vs access token

algoguy344
Here is the example for starting java code:// Initialize Kiteconnect using apiKey.
Kiteconnect kiteSdk = new Kiteconnect("your_apiKey");

// Set userId.
kiteSdk.setUserId("your_userId");

/* First you should get request_token, public_token using kitconnect login and then use request_token, public_token, api_secret to make any kiteconnect api call.
Get login url. Use this url in webview to login user, after authenticating user you will get requestToken. Use the same to get accessToken. */
String url = kiteSdk.getLoginUrl();

// Get accessToken as follows,
UserModel userModel = kiteSdk.requestAccessToken("request_token", "your_apiSecret");

// Set request token and public token which are obtained from login process.
kiteSdk.setAccessToken(userModel.accessToken);
kiteSdk.setPublicToken(userModel.publicToken);

// Set session expiry callback.
kiteSdk.setSessionExpiryHook(new SessionExpiryHook() {
@Override
public void sessionExpired() {
System.out.println("session expired");
}
});

now what i dont understand is that how do i get request token. i do login and a request token is generated and so is an access token. now should i use request token or access token in kiteSdk.requestAccessToken("request_token", "your_apiSecret");....as request token is new every time but access token is same for the day. In https://kite.trade/forum/discussion/3802/request-token-issue#latest you have said that exchange expects user to login every day and therefore, shouldnt the access token be used in the kitesdk.requestaccesstoken method. pls clarify the difference between access token and request token.
Sign In or Register to comment.