Maintainers

👁 adampatterson

Package info

github.com/adampatterson/WpOAuth

Issues

pkg:composer/adampatterson/wpoauth

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

0.0.1 2021-05-01 16:39 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 324196a23a2f77e68681747c316437bbd0db8ad0

  • Adam Patterson <hello.woop@adampatterson.ca>

httpoauthwordpressGuzzleauthrequest

This package is auto-updated.

Last update: 2026-05-29 17:33:24 UTC


README

👁 PHP Composer

A simple oAuth client meant for personal projects

Note

This script is still under development.

Install from Packagist

composer require adampatterson/wpoauth

Basic Usage

$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);

Tests

composer install
composer test

Local Dev

Run from the theme root.

ln -s ~/Sites/packages/WpOAuth ./vendor/adampatterson/wpoauth

I'd reccomend using the WordPress Transients Manager plugin so you can monitor, and invalidate the token storage.