https://github.com/adampatterson/wpoauth
wpOAuth is a package meant to help with the integration of API services into plugins or themes.
https://github.com/adampatterson/wpoauth
php wordpress
Last synced: about 2 months ago
JSON representation
wpOAuth is a package meant to help with the integration of API services into plugins or themes.
- Host: GitHub
- URL: https://github.com/adampatterson/wpoauth
- Owner: adampatterson
- Created: 2021-04-14T20:22:17.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2026-04-29T17:15:16.000Z (2 months ago)
- Last Synced: 2026-05-15T14:07:47.559Z (about 2 months ago)
- Topics: php, wordpress
- Language: PHP
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WordPress oAuth PHP

A simple oAuth client meant for personal projects
> [!NOTE]
> This script is still under development.
## Install from [Packagist](https://packagist.org/packages/adampatterson/wpoauth)
```bash
composer require adampatterson/wpoauth
```
## Basic Usage
```php
$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
```bash
composer install
composer test
```
## Local Dev
Run from the theme root.
```bash
ln -s ~/Sites/packages/WpOAuth ./vendor/adampatterson/wpoauth
```
I'd reccomend using the [WordPress Transients Manager](https://wordpress.org/plugins/transients-manager/) plugin so you can monitor, and invalidate the token storage.