Skip to content
WordPress.org
  • Showcase
  • Plugins
  • Themes
  • Hosting
  • News
    • Learn WordPress
    • Documentation
    • Education
    • Forums
    • Developers
    • Blocks
    • Patterns
    • Photos
    • Openverse ↗︎
    • WordPress.tv ↗︎
    • About WordPress
    • Make WordPress
    • Events
    • Five for the Future
    • Enterprise
    • Gutenberg ↗︎
    • Job Board ↗︎
  • Merch ↗︎
  • Get WordPress
Get WordPress
WordPress.org

Plugin Directory

Auto Login for Cloudflare Access

  • Submit a plugin
  • My favorites
  • Log in
  • Submit a plugin
  • My favorites
  • Log in

Auto Login for Cloudflare Access

By johanneswk
Download
  • Details
  • Reviews
  • Installation
  • Development
Support

Description

Protect /wp-admin (or your whole site) with a Cloudflare Access self-hosted application. When a visitor has signed in through Access, this plugin verifies the Access token (JWT) that Cloudflare sends with every request and logs the visitor in to the WordPress account with the same email address.

  • No passwords: users sign in with any identity provider configured in Cloudflare Access.
  • Strict token validation: RS256 signature against Cloudflare’s published keys, expiry, audience (AUD) and issuer are all checked.
  • Handles Cloudflare’s signing key rotation automatically.
  • Optional redirect of wp-login.php to Cloudflare Access, and logout from Access when logging out of WordPress.
  • Built-in debug log on the settings page for troubleshooting.
  • Settings can be locked in wp-config.php.

Users are never created: the email address must already belong to a WordPress user.

This plugin is a fork of “Auto Login with Cloudflare” by Kan-Ru Chen, which is no longer available. When you activate this plugin, the settings of that plugin are copied over; deactivate and delete the old plugin afterwards.

This plugin is not affiliated with or endorsed by Cloudflare, Inc. Cloudflare and Cloudflare Access are trademarks of Cloudflare, Inc.

Development happens on GitHub.

External services

This plugin connects to Cloudflare Access, a service by Cloudflare, Inc., to verify that a visitor has signed in.

When a request carries a Cloudflare Access token, the plugin downloads the public signing keys of your Access team from https://<your auth domain>/cdn-cgi/access/certs. The keys are cached for up to one hour. Only this request is made; no visitor or site data is sent to Cloudflare by the plugin. Your site is already behind Cloudflare Access, which handles the sign-in itself.

  • Cloudflare Website and Online Services Terms of Use: https://www.cloudflare.com/website-terms/
  • Cloudflare Privacy Policy: https://www.cloudflare.com/privacypolicy/

Installation

  1. In Cloudflare Zero Trust, create a self-hosted Access application that protects at least /wp-admin of your site. See the Cloudflare documentation.
  2. Install and activate the plugin.
  3. Go to Settings → Auto Login for Cloudflare Access and enter:
    • Auth domain: your team domain, for example yourteam.cloudflareaccess.com.
    • Application audience (AUD) tag: found in the Access application’s overview.
  4. Optionally enable Redirect login page so wp-login.php sends users through Cloudflare Access.

Instead of using the settings page you can define the values in wp-config.php. Defined values take precedence and cannot be changed from the admin:

define('WP_CF_ACCESS_AUTH_DOMAIN', 'yourteam.cloudflareaccess.com');
define('WP_CF_ACCESS_JWT_AUD', 'your-aud-tag');
define('WP_CF_ACCESS_REDIRECT_LOGIN', true);
define('WP_CF_ACCESS_DEBUG_MODE', false);

FAQ

A user is not logged in. How do I find out why?

Enable debug mode on the settings page and reload a protected page. Every step of the validation is shown in the debug log. Authentication failures are also written to the PHP error log.

How do I send the WordPress login page to Cloudflare Access?

Enable Redirect login page. Visitors to wp-login.php are redirected to /wp-admin/, where Cloudflare Access asks them to sign in. Make sure your Access application protects /wp-admin, otherwise this causes a redirect loop.

Is my server still reachable without Cloudflare?

That depends on your hosting. Tokens are always verified, but for the best protection only allow traffic to your server from Cloudflare, for example with Cloudflare Tunnel or a firewall allowlist.

Does the plugin create WordPress users?

No. The email address from Cloudflare Access must match an existing user.

What data does the debug log store?

Up to 100 recent messages, including email addresses, user names and IP addresses, for at most one week. Clear it with the Clear Debug Logs button. Everything is removed when the plugin is deleted.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Auto Login for Cloudflare Access” is open source software. The following people have contributed to this plugin.

Contributors
  • johanneswk

Translate “Auto Login for Cloudflare Access” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0.1

  • Maintenance: new plugin icon and automated release process. No functional changes.

1.0.0

  • First release in the WordPress.org directory, continuing “Auto Login with Cloudflare” by Kan-Ru Chen.
  • Settings of the original plugin are copied over on activation.
  • Strict Cloudflare Access token validation with firebase/php-jwt 7.2.2: RS256 signature, required expiry, audience, issuer and email.
  • Automatic handling of Cloudflare signing key rotation and outages.
  • Validated settings, debug log on the settings page, and full cleanup when the plugin is deleted.

Meta

  • Version 1.0.1
  • Last updated 9 hours ago
  • Active installations Fewer than 10
  • WordPress version 6.3 or higher
  • Tested up to 7.1.5
  • PHP version 8.0 or higher
  • Tags
    jwtloginssozero trust
  • Advanced View

Ratings

No reviews have been submitted yet.

Your review

See all reviews

Contributors

  • johanneswk

Support

Got something to say? Need help?

View support forum

  • About
  • News
  • Hosting
  • Privacy
  • Showcase
  • Themes
  • Plugins
  • Patterns
  • Learn
  • Documentation
  • Developers
  • WordPress.tv ↗
  • Get Involved
  • Events
  • Donate ↗
  • Merch ↗
  • WordPress.com ↗
  • Matt ↗
  • bbPress ↗
  • BuddyPress ↗
WordPress.org

The WordPress® trademark is the intellectual property of the WordPress Foundation.

  • Visit our X (formerly Twitter) account
  • Visit our Bluesky account
  • Visit our Mastodon account
  • Visit our Threads account
  • Visit our Facebook page
  • Visit our Instagram account
  • Visit our LinkedIn account
  • Visit our TikTok account
  • Visit our YouTube channel
  • Visit our Tumblr account
Code is Poetry