How to modify token expiration date?

I’m using SuiteCRM API’s and the token expires quickly.
any suggestions on how to modify it ?

Hi,
Are you talking about V8 api tokens??

yes , I’m talking about V8 Api

Can you not just call the related refresh token? which would provided you with a new valid token

Secondly, worth checking the PHP.ini as I assume that’s where you change the token expiry timer

Can you elaborate your answer please

What to do in php.ini and how to modify the exoiration date?

go to file vendor\league\oauth2-server\src\Grant\AbstractGrant.php
in the function name “issueAccessToken” you’ll see the line set time expired like this

$accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL));

so if you want to custom expired time, you should modify DateTime in this line
e.g: if you want life time of this token in 25 hour (1 day and plus 1 hour), you can write like this:

$accessToken->setExpiryDateTime((new \DateTime('+1 day'))->add($accessTokenTTL));
1 Like