Skip to content

wpOAuth is a package meant to help with the integration of API services into plugins or themes.

Notifications You must be signed in to change notification settings

adampatterson/WpOAuth

Repository files navigation

WordPress oAuth PHP

PHP Composer

A simple oAuth client meant for personal projects

This script is still under development.

Install from Packagist

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

composer require adampatterson/wpoauth

Tests

$ composer global require phpunit/phpunit
$ export PATH=~/.composer/vendor/bin:$PATH
$ which phpunit
~/.composer/vendor/bin/phpunit

composer run-script test

Local Dev

Run from the themes root.

ln -s ~/Sites/personal/_packages/WpOAuth ./vendor/adampatterson/wpoauth

https://wordpress.org/plugins/transients-manager/

About

wpOAuth is a package meant to help with the integration of API services into plugins or themes.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published