VOOZH about

URL: https://deepwiki.com/auth0/wordpress/1.1-what-is-auth0-wordpress-plugin

⇱ What is Auth0 WordPress Plugin | auth0/wordpress | DeepWiki


Loading...
Menu

What is Auth0 WordPress Plugin

The Auth0 WordPress Plugin replaces the standard WordPress login flow with Auth0's Universal Login experience, enabling enterprise-grade authentication features such as Multi-Factor Authentication (MFA), Single Sign-On (SSO), Passwordless, and PassKey authentication. This document explains the plugin's core purpose, the problems it solves, and its relationship to the Auth0-PHP SDK.

Sources: README.md10-12 wpAuth0.php3-6


Core Purpose

The Auth0 WordPress Plugin is a WordPress integration that replaces wp-login.php with a redirect to Auth0's Universal Login page. When users attempt to log in, they are sent to Auth0 for authentication, then redirected back to WordPress with a secure token. The plugin exchanges this token for user information and creates or updates the corresponding WordPress user account.

What the Plugin Does

FunctionImplementation
Replace WordPress LoginIntercepts wp-login.php requests and redirects to Auth0 Universal Login
Process Authentication CallbacksHandles OAuth/OIDC authorization code exchange and token validation
Synchronize User DataMaintains bidirectional sync between WordPress wp_users table and Auth0 user profiles
Manage SessionsPairs WordPress authentication cookies with Auth0 sessions for consistent state
Store Connection MappingsMaps WordPress user IDs to Auth0 identities in the auth0_accounts custom table

The plugin is built on the Auth0\SDK\Auth0 class from the Auth0-PHP SDK v8.18+, which handles all Auth0 protocol implementation and API communication.

Sources: README.md10-12 wpAuth0.php22-24 README.md171-172


Problems It Solves

WordPress's native authentication system has significant limitations for modern web applications. The Auth0 WordPress Plugin addresses these problems by delegating authentication to Auth0's platform:

Security Limitations of WordPress Native Login

WordPress LimitationAuth0 SolutionPlugin Implementation
Password-only authenticationMFA, Passwordless, PassKey, biometric optionsConfigured in Auth0 tenant; plugin handles all authentication flows
No built-in MFASMS, Email, Authenticator app, Push notificationsAuth0 enforces MFA policies; plugin receives authenticated users
Vulnerable password reset flowSecure passwordless authentication and magic linksPlugin redirects all authentication to Auth0
No SSO capabilityEnterprise SSO with SAML, OAuth, OIDC connectionsPlugin receives SSO session tokens from Auth0
Limited social login support30+ social identity providers (Google, GitHub, Apple, etc.)Plugin maps social identities to WordPress users
No adaptive authenticationRisk-based authentication, anomaly detection, bot detectionAuth0 tenant policies apply to all plugin logins
Manual user provisioningJust-in-time provisioning from enterprise directoriesPlugin creates WordPress users automatically from Auth0 identities

Enterprise Requirements

Organizations with compliance, security, or user experience requirements cannot rely on WordPress's basic authentication. The plugin enables:

  • Compliance: Meet SOC 2, HIPAA, GDPR requirements through Auth0's certified platform
  • Centralized Identity: Single source of truth for user identities across multiple applications
  • Audit Logging: Complete authentication event logs in Auth0 dashboard
  • Session Control: Centralized session revocation and back-channel logout support
  • Identity Federation: Connect to enterprise identity providers (Active Directory, Okta, etc.)

Sources: README.md10-12 CHANGELOG.md28-35


Plugin vs SDK: Critical Distinction

The Auth0 WordPress Plugin is not a Software Development Kit. Its internal classes, methods, and APIs are explicitly marked as internal and will change without backward compatibility guarantees.

Supported vs Unsupported Usage


Supported Developer Access Pattern



























API SurfaceStabilityUsage
wpAuth0() global function defined in wpAuth0.php79-89Public/StableSafe to call from any WordPress code
Auth0\WordPress\Plugin::getSdk() methodPublic/StableReturns configured Auth0\SDK\Auth0 instance
All other Auth0\WordPress\* classes and methodsInternal/UnstableWill change without notice - do not use

Sources: README.md14-15 README.md169-184 wpAuth0.php79-89


System Architecture

The plugin operates as an integration layer between WordPress and Auth0, with a clear separation of responsibilities across three tiers:


Layer Responsibilities

LayerFile/Class LocationPurpose
Entry PointwpAuth0.php1-90Defines plugin metadata, registers activation hook, loads autoloader
Plugin Coresrc/Plugin.phpSingleton orchestrator; initializes SDK; registers action classes
Action Classessrc/Actions/*.phpInternal handlers for authentication, configuration, synchronization
Auth0 SDKAuth0\SDK\Auth0 (external dependency)Implements OAuth/OIDC protocols and Auth0 API clients
Custom TablesCreated by src/Database.phpStore Auth0-WordPress user mappings and sync event queues

The plugin's internal classes (Auth0\WordPress\*) are not designed for extension. Custom development must use the SDK layer (Auth0\SDK\Auth0) accessed via wpAuth0()->getSdk().

Sources: wpAuth0.php1-90 README.md171-172


Plugin Entry Point: wpAuth0.php and wpAuth0()

WordPress loads the plugin through wpAuth0.php1-90 which performs three bootstrap operations:

1. Dependency Autoloading


The scoped autoloader prefixes all vendor dependencies under Auth0\WordPress\Vendor\* to prevent namespace conflicts with other WordPress plugins.

2. Activation Hook Registration


Generates three cryptographic secrets (128 hex characters each) stored in wp_options:

  • auth0_cookies['secret'] - encrypts session cookies
  • auth0_backchannel_logout['secret'] - validates BCL webhook signatures
  • auth0_authentication['fallback_secret'] - fallback authentication validation

3. Global Helper Function


The wpAuth0() function implements a singleton pattern, returning the same Auth0\WordPress\Plugin instance on every call. The first invocation creates the instance, initializes the Auth0\SDK\Auth0 object, and registers WordPress hooks via wpAuth0()->run() at wpAuth0.php70

Sources: wpAuth0.php34-90


How WordPress Users Map to Auth0 Identities

The plugin maintains a connection mapping between WordPress user accounts and Auth0 identities using the custom auth0_accounts database table:


User Resolution Process

When a user authenticates through Auth0 and returns to WordPress:

  1. The Auth0\WordPress\Actions\Authentication class receives the Auth0 sub claim (e.g., auth0|507f1f77bcf86cd799439011)
  2. Plugin queries auth0_accounts table for matching connection column value
  3. If found: logs in the WordPress user with matching user_id
  4. If not found: creates new WordPress user in wp_users and new row in auth0_accounts
TableColumnPurpose
auth0_accountsuser_idForeign key to wp_users.ID
auth0_accountsconnectionAuth0 sub claim (identity provider + unique ID)
auth0_accountscreated_atTimestamp when mapping was created

This mapping allows a single WordPress user to have multiple Auth0 identities (e.g., Google social login and enterprise SAML connection), all linking to the same WordPress account.

Sources: README.md157-161


Plugin Dependencies

The Auth0 WordPress Plugin requires both WordPress components and external PHP libraries:

WordPress Requirements

RequirementVersionVerified By
WordPress Core6.0+wpAuth0.php8
PHP Runtime8.1, 8.2, or 8.3wpAuth0.php11
Database PrivilegesTable creation permissionsRequired during activation
WordPress CronConfigured for background tasksRequired for sync operations

PHP SDK Dependencies

The plugin is built on the Auth0-PHP SDK v8.18+:


When installed via Composer (recommended), the plugin requires PSR-18 and PSR-17 implementations. The README.md64-66 example uses:

  • symfony/http-client (PSR-18 HTTP Client)
  • nyholm/psr7 (PSR-17 HTTP Factories)

Other compatible implementations can be substituted. See Installation for Composer dependency details.

Dependency Isolation

Production builds use PHP Scoper to prefix all vendor dependencies under Auth0\WordPress\Vendor\* namespace, preventing conflicts with other WordPress plugins that may use different versions of the same libraries.

Sources: wpAuth0.php8-11 wpAuth0.php22-24 README.md64-77


Custom Database Tables

The plugin creates two custom tables in the WordPress database during activation:

auth0_accounts

Stores the mapping between WordPress user IDs and Auth0 identity providers:

ColumnTypePurpose
idPrimary KeyAuto-incrementing row identifier
user_idForeign KeyReferences wp_users.ID
connectionVARCHARAuth0 sub claim (e.g., `auth0
created_atTIMESTAMPWhen the mapping was created

auth0_sync

Queues user synchronization events for background processing by WordPress Cron:

ColumnTypePurpose
idPrimary KeyAuto-incrementing row identifier
event_typeVARCHAREvent type: user_created, user_updated, user_deleted
user_idIntegerWordPress user ID that triggered the event
payloadJSONEvent data to sync to Auth0
statusVARCHARProcessing status: pending, processing, completed, failed
created_atTIMESTAMPWhen event was queued
processed_atTIMESTAMPWhen event was processed (NULL if pending)

The auth0_sync table enables bidirectional synchronization between WordPress and Auth0. When WordPress user accounts are created, updated, or deleted, events are queued here and processed by the background sync system, which calls the Auth0 Management API to replicate changes.

Sources: README.md157-161 README.md163-168


Summary

The Auth0 WordPress Plugin is a WordPress integration, not an extensible SDK. It replaces WordPress's default login system with Auth0's Universal Login while maintaining compatibility with WordPress's user database through connection mapping and synchronization.

Key Characteristics:

  • Entry Point: wpAuth0.php bootstrap file
  • Core Class: Auth0\WordPress\Plugin singleton
  • Built On: Auth0-PHP SDK v8.17+
  • Extension Point: wpAuth0()->getSdk() returns the configured SDK instance
  • Integration Method: WordPress action/filter hooks
  • Database: Custom tables (auth0_accounts, auth0_sync) plus WordPress options

Developers seeking to customize authentication behavior should use the Auth0-PHP SDK directly through the provided getSdk() method, not by extending the plugin's internal classes.

Sources: README.md10-15 README.md169-184 Diagram 1, Diagram 2