A simple oAuth client meant for personal projects
This script is still under development.
Install from Packagist
composer require adampatterson/wpoauth$wpOAuthParams = [
"authUrl" => "https://auth.com/connect/authorize",
"tokenUrl" => "https://auth.com/connect/token",
"clientRedirect" => "https://site.com/?callback=wpoauth",
"clientId" => CLIENT_ID,
"clientSecret" => CLIENT_SECRET,
"scope" => "read offline_access",
"response_type" => "code",
"expires_in" => HOUR_IN_SECONDS - 1,
"refresh_expires_in" => (WEEK_IN_SECONDS * 2) - 1,
"transient_prefix" => 'change_me'
"should_log" => true,
"log_path" => __DIR__.'/_log.php',
];
$this->wpOAuth = new WpOAuth($wpOAuthParams);$ composer install
$ export PATH=~/.composer/vendor/bin:$PATH
$ which phpunit
~/.composer/vendor/bin/phpunit
composer run-script testRun from the themes root.
ln -s ~/Sites/packages/WpOAuth ./vendor/adampatterson/wpoauthI'd reccomend using the WordPress Transients Manager plugin so you can monitor, and invalidate the token storage.