PHPackages                             auth0/wordpress - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. auth0/wordpress

ActiveWordpress-plugin[Authentication &amp; Authorization](/categories/authentication)

auth0/wordpress
===============

WordPress Plugin for Auth0

5.5.0(5mo ago)17419.5k↓29.2%105[6 PRs](https://github.com/auth0/wordpress/pulls)MITPHPPHP ^8.1

Since Mar 1Pushed 5mo ago68 watchersCompare

[ Source](https://github.com/auth0/wordpress)[ Packagist](https://packagist.org/packages/auth0/wordpress)[ RSS](/packages/auth0-wordpress/feed)WikiDiscussions 5.x Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (74)Used By (0)Security (5)

[![WordPress by Auth0](https://camo.githubusercontent.com/cda2aeba36a5e6248f22454c1fcb3171c17a5da020920f52298706664e57a03b/68747470733a2f2f63646e2e61757468302e636f6d2f776562736974652f73646b732f62616e6e6572732f77702d61757468302d62616e6e65722e706e67)](https://camo.githubusercontent.com/cda2aeba36a5e6248f22454c1fcb3171c17a5da020920f52298706664e57a03b/68747470733a2f2f63646e2e61757468302e636f6d2f776562736974652f73646b732f62616e6e6572732f77702d61757468302d62616e6e65722e706e67)

WordPress Plugin for [Auth0](https://auth0.com) Authentication

[![License](https://camo.githubusercontent.com/cfb90048af2bef349adc799869458c3378c1642ec1a2bd989c16c2a29a6756b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61757468302f61757468302d706870)](https://doge.mit-license.org/)[![Ask DeepWiki](https://camo.githubusercontent.com/0f5ae213ac378635adeb5d7f13cef055ad2f7d9a47b36de7b1c67dbe09f609ca/68747470733a2f2f6465657077696b692e636f6d2f62616467652e737667)](https://deepwiki.com/auth0/wordpress)

🚀 [Getting Started](#getting-started) - 💻 [SDK Usage](#sdk-usage) - 📆 [Support Policy](#support-policy) - 💬 [Feedback](#feedback)

Overview
--------

[](#overview)

The Auth0 WordPress plugin replaces the standard WordPress login flow with a new authentication process using Auth0's Universal Login experience. This enables you to secure your WordPress site with Auth0's advanced features, such as MFA, SSO, Passwordless, PassKey, and so on.

Important

This plugin is **NOT** a SDK (Software Development Kit.) It's APIs are internal and not intended for developers to extend directly. We do not support altering the plugin's behavior or integrating it in any way beyond what is outlined in this README. If you're looking to build a more extensive integration, please create a solution using the [Auth0-PHP SDK](https://github.com/auth0/auth0-php) instead.

Warning

v4 of the plugin is no longer supported as of June 2023. We are no longer providing new features or bugfixes for that release. Please upgrade to v5 as soon as possible.

Getting Started
---------------

[](#getting-started)

### Requirements

[](#requirements)

- PHP 8.1+
- [Most recent version of WordPress](https://wordpress.org/news/category/releases/)
- Database credentials with table creation permissions

> Please review our [support policy](#support-policy) on specific PHP and WordPress versions and when they may exit support in the future.

### Installation

[](#installation)

#### Composer

[](#composer)

The plugin supports installation through [Composer](https://getcomposer.org/), and is [WPackagist](https://wpackagist.org/) compatible. This approach is preferred when using [Bedrock](https://roots.io/bedrock/), but will work with virtually any WordPress installation.

For [Bedrock](https://roots.io/bedrock/) installations, you'll usually run this command from the root WordPress installation directory, but check the documentation the project's maintainers provide for the best guidance.

For standard WordPress installations, this command can be run from the `wp-content/plugins` sub-directory.

```
composer require symfony/http-client nyholm/psr7 auth0/wordpress:^5.0

```

**Note on Composer Dependencies**When installed with Composer, the plugin depends on the presence of [PSR-18](https://packagist.org/providers/psr/http-client-implementation) and [PSR-17](https://packagist.org/providers/psr/http-factory-implementation) library implementations. The `require` command above includes two such libraries (`symfony/http-client` and `nyholm/psr7`) that satisfy these requirements, but you can use any other compatible libraries that you prefer. Visit Packagist for a list of [PSR-18](https://packagist.org/providers/psr/http-client-implementation) and [PSR-17](https://packagist.org/providers/psr/http-factory-implementation) providers.

If you are using Bedrock or another Composer-based configuration, you can try installing `auth0/wordpress` without any other dependencies, as the implementations may be satisfied by other already installed packages.

> **Note** PHP Standards Recommendations (PSRs) are standards for PHP libraries and applications that enable greater interoperability and choice. You can learn more about them and the PHP-FIG organization that maintains them [here](https://www.php-fig.org/).

### Activation

[](#activation)

After installation, you must activate the plugin within your WordPress site:

1. Open your WordPress Dashboard.
2. Select 'Plugins' from the sidebar, and then 'Installed Plugins.'
3. Choose 'Activate' underneath the plugin's name.

### Configure Auth0

[](#configure-auth0)

1. Sign into Auth0. If you don't have an account, [it's free to create one](https://auth0.com/signup).
2. [Open 'Applications' from your Auth0 Dashboard](https://manage.auth0.com/#/applications/create), and select 'Create Application.'
3. Choose 'Regular Web Application' and then 'Create.'
4. From the newly created application's page, select the Settings tab.

Please prepare the following information:

- Note the **Domain**, **Client ID**, and **Client Secret**, available from the newly created Application's Settings page. You will need these to configure the plugin in the next step.
- From your WordPress Dashboard's General Settings page, note your **WordPress Address** and **Site Address** URLs. We recommend you read our guidance on [common WordPress URL issues](#common-wordpress-url-issues).

Continue configuring your Auth0 application from its Settings page:

- **Allowed Callback URLs** should include the URL to your WordPress site's `wp-login.php`.
    - In most (but not all) cases, this will be your WordPress Address with `/wp-login.php` appended.
    - Please ensure your site is configured never to cache this URL, or you may see an "invalid state" error during login.
- **Allowed Web Origins** should include both your WordPress Address and Site Address URLs.
- **Allowed Logout URLs** should consist of your WordPress Address.

**Common WordPress URL Issues**- These must be the URLs your visitors will use to access your WordPress site. If you are using a reverse proxy, you may need to manually configure your WordPress Address and Site Address URLs to match the URL you use to access your site.
- Make sure these URLs match your site's configured protocol. When using a reverse proxy, you may need to update these to reflect serving over SSL/HTTPS.

**Troubleshooting**If you're encountering issues, start by checking that your Auth0 Application is setup like so:

- **Application Type** must be set to **Regular Web Application**.
- **Token Endpoint Authentication Method** must be set to **Post**.
- **Allowed Origins (CORS)** should be blank.

Scroll down and expand the "Advanced Settings" panel, then:

- Under **OAuth**:
    - Ensure that **JsonWebToken Signature Algorithm** is set to **RS256**.
    - Check that **OIDC Conformant** is enabled.
- Under **Grant Types**:
    - Ensure that **Implicit**, **Authorization Code**, and **Client Credentials** are enabled.
    - You may also want to enable **Refresh Token**.

### Configure the Plugin

[](#configure-the-plugin)

Upon activating the Auth0 plugin, you will find a new "Auth0" section in the sidebar of your WordPress Dashboard. This section enables you to configure the plugin in a variety of ways.

For the plugin to operate, at a minimum, you will need to configure the Domain, Client ID, and Client Secret fields. These are available from the Auth0 Application you created in the previous step. Once configured, select the "Enable Authentication" option to have the plugin begin handling authentication for you.

We recommend testing on a staging/development site using a separate Auth0 Application before putting the plugin live on your production site.

### Configure WordPress

[](#configure-wordpress)

#### Plugin Database Tables

[](#plugin-database-tables)

The plugin uses dedicated database tables to guarantee high performance. When the plugin is activated, it will use the database credentials you have configured for WordPress to create these tables.

Please ensure your configured credentials have appropriate privileges to create new tables.

#### Cron Configuration

[](#cron-configuration)

The plugin uses WordPress' [background task manager](https://developer.wordpress.org/plugins/cron/) to perform important periodic tasks. Proper synchronization between WordPress and Auth0 relies on this.

By default, WordPress' task manager runs on every page load, which is inadvisable for production sites. For best performance and reliability, please ensure you have configured WordPress to use a [cron job](https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/) to run these tasks periodically instead.

SDK Usage
---------

[](#sdk-usage)

The plugin is built on top of [Auth0-PHP](https://github.com/auth0/auth0-PHP) — Auth0's full-featured PHP SDK for Authentication and Management APIs.

For custom WordPress development, please do not extend the plugin's classes themselves, as this is not supported. Nearly all of the plugin's APIs are considered `internal` and will change over time, most likely breaking any custom extension built upon them.

Instead, please take advantage of the full PHP SDK that the plugin is built upon. You can use the plugin's `getSdk()` method to retrieve a configured instance of the SDK, ready for use. This method can be called from the plugin's global `wpAuth0()` helper, which returns the WordPress plugin itself.

```
