Download the PHP package joshcanhelp/wp-rest-api-auth0 without Composer
On this page you can find all versions of the php package joshcanhelp/wp-rest-api-auth0. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshcanhelp/wp-rest-api-auth0
More information about joshcanhelp/wp-rest-api-auth0
Files in joshcanhelp/wp-rest-api-auth0
Package wp-rest-api-auth0
Short Description Protect a WP REST API with OAuth2 using Auth0
License MIT
Homepage https://www.joshcanhelp.com/protect-wordpress-rest-api-with-oauth2-auth0/
Informations about the package wp-rest-api-auth0
Protect your WordPress REST API with Auth0
This repo contains a working MU plugin that will receive and validate access tokens obtained from Auth0. For information on how this works and the values used within please see the post here:
Protect your WordPress REST API with OAuth2 using Auth0
Installation
First, install the Login by Auth0 plugin, then add your Auth0 credentials to wp-config.php
, a file in wp-content/mu-plugins
, or another location that will get loaded before this plugin.
Install with Composer
Install this package:
Require the Composer autoloader at some point when add_action
is available, like in wp-content/mu-plugins
.
Install manually
To install this manually without Composer, just download the latest release ZIP and upload through the admin interface. Please note that this plugin will not update automatically; updates will need to be made by deleting and re-adding (make sure your site is in maintenance mode) or directly via an FTP client (not recommended).
Testing with Docker
You can get this running to test it out locally with Docker using this Gist.
Troubleshooting
Try setting AUTH0_API_DEBUG
to true
and watching your WP error log for information on failures.
If API requests aren't working, Apache might not be passing authorization headers to PHP. Try adding this line (or similar methods) to .htaccess
:
Also, make sure your WP API endpoint doesn't follow this pattern, where /index.php/
is required before /wp-json/
:
See this solution to help resolve this index.php issue.