Access Token Validity

Is there any method by which we can check if the access token we have currently is valid or not .. For example if I get a accesstoken 12345 today and got it stored in database, but for tomorrow I need to get the new accesstoken. So I need to first check if the current access token is valid or not..

The current method to setaccesstoken i.e $kite->setAccessToken($accesstoken) gives a true response even if we pass the incorrect access token.

Basically what I want to do is tht I want to check if the accesstoken has expired and if yes than redirect to the loginurl to run the login process..
  • rishiswethan
    Just call try to get a quote for a company, if you get an invalid API exception, it's expired. Else if you get a quote it's value
  • hitman1980
    Thanks .. I was doing it using catch try only .. But was getting fatal error ..

    But than I tried catching the exception instead of error.. and it solved the issue..
This discussion has been closed.