Screenshot WOW SAVE 20% on the All Access Bundle. Use "OAUTH20OFF" at checkout.
3rd Party Integration

Never Expiring / Lifetime Access Token

Published: April 14, 2019 | Updated: December 7th, 2021
  1. Home
  2. Docs
  3. How To
  4. Never Expiring / Lifetime Access Token

If should be noted that setting an access token without an expiration is not considered “Best Practice”.

The core of WP OAuth Server is built using standard practice and stores all access tokens in the database without open to direct modification. If you desire to assign no expiration to access tokens, you can use a filter to modify the expiration time during the query.

Place the following code in the theme’s functions.php file

add_filter( 'wo_get_access_token_expires_return','wo_modify_expires_token' ); 
function wo_modify_expires_token( $expires ) { 
    return strtotime( '+99 years', $expires );