How to set Rest API oAuth token expire in minutes or seconds in admin. Currently it's showing hours and it will not accept like 0.5(for 30 minute etc) magento2. Any One know about this, please help me asap.
As Magento DevDocs said you can not edit this setting.
You have one Option Also
Step 1: Set the value as non trace able value for ex: 7856467.
Step 2: Search this value directly in DB, then edit and Save this value as 0.5
Here code is set according to hours, so if you want to set it for 15mins then, you need to calculate with formula
n/60 = value
for ex - 15/60 = 0.25.
Override This file - Path : vendor\magento\module-integration\Helper\Oauth\Data.php
And Update the Value as (need to remove (int) )
$hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/customer'); return $hours > 0 ? $hours : 0;
And Then Run Commands
php bin/magento s:up && php bin/magento s:d:c && php bin/magento s:s:d -f && php bin/magento c:c && php bin/magento c:f
so basically you need to do it like this
Hope this will solve your problem.