auth0/wordpress
Composer 安装命令:
composer require auth0/wordpress
包简介
WordPress Plugin for Auth0
关键字:
README 文档
README
WordPress Plugin for Auth0 Authentication
🚀 Getting Started - 💻 SDK Usage - 📆 Support Policy - 💬 Feedback
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 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
Requirements
- PHP 8.1+
- Most recent version of WordPress
- Database credentials with table creation permissions
Please review our support policy on specific PHP and WordPress versions and when they may exit support in the future.
Installation
Composer
The plugin supports installation through Composer, and is WPackagist compatible. This approach is preferred when using Bedrock, but will work with virtually any WordPress installation.
For 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 and PSR-17 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 and PSR-17 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.
Activation
After installation, you must activate the plugin within your WordPress site:
- Open your WordPress Dashboard.
- Select 'Plugins' from the sidebar, and then 'Installed Plugins.'
- Choose 'Activate' underneath the plugin's name.
Configure Auth0
- Sign into Auth0. If you don't have an account, it's free to create one.
- Open 'Applications' from your Auth0 Dashboard, and select 'Create Application.'
- Choose 'Regular Web Application' and then 'Create.'
- 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.
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.phpappended. - Please ensure your site is configured never to cache this URL, or you may see an "invalid state" error during login.
- In most (but not all) cases, this will be your WordPress Address with
- 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
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
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
The plugin uses WordPress' background task manager 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 to run these tasks periodically instead.
SDK Usage
The plugin is built on top of 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.
<?php $plugin = wpAuth0(); // Returns an instanceof Auth0\WordPress\Plugin $sdk = wpAuth0()->getSdk(); // Returns an instanceof Auth0\SDK\Auth0
Please direct questions about developing with the Auth0-PHP SDK to the Auth0 Community, and issues or feature requests to it's respective repository. Documentations and examples on working with the Auth0-PHP SDKs are also available from its repository.
Support Policy
- Our PHP version support window mirrors the PHP release support schedule. Our support for PHP versions ends when they stop receiving security fixes.
- As Automattic's stated policy is "security patches are backported when possible, but this is not guaranteed," we only support the latest release marked as "actively supported" by Automattic.
| Plugin Version | WordPress Version | PHP Version | Support Ends |
|---|---|---|---|
| 5 | 6 | 8.3 | Nov 2026 |
| 8.2 | Dec 2025 | ||
| 8.1 | Nov 2024 |
Composer and WordPress do not offer upgrades to incompatible versions. Therefore, we regularly deprecate support within the plugin for PHP or WordPress versions that have reached end-of-life. These deprecations are not considered breaking changes and will not result in a major version bump.
Sites running unsupported versions of PHP or WordPress will continue to function but will not receive updates until their environment is upgraded. For your security, please ensure your PHP runtime and WordPress remain up to date.
Feedback
Contributing
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
Raise an issue
To provide feedback or report a bug, please raise an issue on our issue tracker.
Vulnerability Reporting
Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
Auth0 is an easy-to-implement, adaptable authentication and authorization platform.
To learn more checkout Why Auth0?
This project is licensed under the MIT license. See the LICENSE file for more info.
auth0/wordpress 适用场景与选型建议
auth0/wordpress 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23.91k 次下载、GitHub Stars 达 181, 最近一次更新时间为 2022 年 12 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「authorization」 「api」 「OpenId」 「Authentication」 「oauth」 「login」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 auth0/wordpress 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 auth0/wordpress 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 auth0/wordpress 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Bare-bones OpenID Connect client
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Customize JWT claims in Laravel Passport access tokens
Multi-provider authentication framework for PHP
DreamFactory Oasys(tm) Open Authentication System
统计信息
- 总下载量: 23.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 181
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-09