Login with Supabase
Authenticate WordPress users through any Supabase OAuth provider and sync them into WordPress.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/solepole/login-with-supabase/archive/refs/heads/main.zipAuthenticate WordPress users through any Supabase OAuth provider and sync them into WordPress.
Features
- Support for multiple OAuth providers (Google, GitHub, Azure, GitLab, Facebook, Apple, etc.)
- Automatic user creation and synchronization
- Customizable login button placement
- Full button shortcode and compact icon shortcode support
- Icon shortcode works in navigation menus (FSE Site Editor and Classic Menus)
- Secure REST API authentication
- Integration with Sensei LMS login/register forms
- Integration with WooCommerce login/register forms
Installation
Standard WordPress Installation
- Download or clone this plugin
- Upload to
/wp-content/plugins/login-with-supabase/ - Activate through the WordPress admin panel
- Configure your Supabase credentials in Settings > Login with Supabase
WordPress.com Installation (Business Plan or Higher)
WordPress.com has stricter security policies. Follow these steps:
-
Zip the plugin folder before uploading
cd wp-content/plugins zip -r login-with-supabase.zip login-with-supabase/ -
Upload via WordPress.com admin:
- Go to My Sites > Plugins > Upload Plugin
- Choose the
login-with-supabase.zipfile - Click "Install Now"
- Activate the plugin
-
Configure the plugin:
- Go to Settings > Login with Supabase
- Enter your Supabase Project URL
- Enter your Supabase Anon/Public Key
- Select which OAuth providers to enable
- Save settings
-
Clear WordPress.com cache (important!):
- Go to My Sites > Manage > Settings
- Scroll to Performance section
- Click "Clear Cache"
Or use the WP Super Cache plugin to clear cache if installed.
Configuration
-
Supabase Setup:
- Create a project at supabase.com
- Go to Authentication > Providers
- Enable and configure your desired OAuth providers
- Note your Project URL and anon/public key from Settings > API
-
WordPress Setup:
- Navigate to Settings > Login with Supabase
- Enter your Supabase Project URL (e.g.,
https://xxxxx.supabase.co) - Enter your Supabase Anon Key
- Select which providers to enable
- Optionally set a custom redirect URL after login
- Choose whether to show login buttons on the default WordPress login page
- Choose whether to show login buttons on Sensei LMS forms (requires Sensei LMS plugin)
- Choose whether to show login buttons on WooCommerce forms (requires WooCommerce plugin)
Usage
Automatic Display
By default, the login buttons will appear on the /wp-login.php page automatically.
Sensei LMS Integration
If you have Sensei LMS plugin installed, you can enable the "Add buttons to Sensei LMS forms" option in plugin settings. This will automatically display the Supabase login buttons on:
- Sensei login form (typically at
/my-courseswhen not logged in) - Sensei register form
The buttons will appear at the bottom of both forms with a separator line, maintaining a clean integration with Sensei's native forms.
WooCommerce Integration
If you have WooCommerce plugin installed, you can enable the "Add buttons to WooCommerce forms" option in plugin settings. This will automatically display the Supabase login buttons on:
- WooCommerce login form (typically at
/my-accountwhen not logged in) - WooCommerce register form
The buttons will appear at the bottom of both forms with a separator line, maintaining a clean integration with WooCommerce's native forms.
Shortcode
Use the shortcode to display login buttons anywhere:
[login_with_supabase]
Shortcode Attributes:
layout:vertical(default) orhorizontalwrapper_class: Add custom CSS classes
Example:
[login_with_supabase layout="horizontal" wrapper_class="my-custom-class"]
Icon Shortcode (New!)
Display individual provider icons for a more compact login option:
[lws provider="azure"]
Icon Shortcode Attributes:
provider: (required) The OAuth provider name -azure,google,github,gitlab,facebook,apple, etc.size: (optional) Icon size -small,medium(default), orlargetitle: (optional) Custom tooltip text on hover
Examples:
[lws provider="azure"]
[lws provider="google" size="large"]
[lws provider="github" size="small" title="Sign in with GitHub"]
Multiple Icons in a Row:
[lws provider="google"] [lws provider="azure"] [lws provider="github"]
In Navigation Menus: The icon shortcode works perfectly in WordPress navigation menus:
- Go to Appearance → Editor → Navigation (or Appearance → Menus for classic themes)
- Add a Navigation Link
- Set the Label to:
[lws provider="azure"] - Set the URL to:
#(or any value) - Save your navigation
The shortcode will render as a clickable icon that triggers authentication!
Supported Providers: azure, google, github, gitlab, facebook, apple, etc
Troubleshooting
Issue: Buttons show but icons are missing
Solution: This is usually a CSS caching issue on WordPress.com.
- Clear your WordPress.com cache (see installation steps above)
- Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)
- Check browser console for errors by adding
?lws_debug=1to the URL
Issue: Buttons are not clickable
Causes:
- JavaScript not loading properly
- Script conflicts with other plugins
- WordPress.com security restrictions blocking scripts
Solutions:
-
Enable Debug Mode: Add
?lws_debug=1to your login URL and check browser console:https://yoursite.com/wp-login.php?lws_debug=1Look for messages starting with
[LWS]to see what's happening. -
Check for JavaScript errors:
- Open browser Developer Tools (F12)
- Go to Console tab
- Look for any red error messages
- Share these errors if you need help
-
Verify script loading:
- In Developer Tools, go to Network tab
- Refresh the page
- Look for:
supabase.min.js(should load from CDN)front.js(your plugin script)front.css(your plugin styles)
- If any show red/failed status, there's a loading issue
-
Disable other plugins temporarily:
- Deactivate other plugins one by one
- Test if the login button works after each deactivation
- This helps identify plugin conflicts
-
Check Supabase Configuration:
- Verify your Supabase URL is correct (should be
https://xxxxx.supabase.co) - Verify your anon key is correct
- Check that OAuth providers are properly configured in Supabase dashboard
- Make sure your site URL is added to Supabase's allowed redirect URLs
- Verify your Supabase URL is correct (should be
Issue: Authentication succeeds but doesn't redirect
Solution:
- Check WordPress REST API is accessible at
/wp-json/login-with-supabase/v1/session - Verify the redirect URL in plugin settings
- Check for PHP errors in WordPress error logs
Issue: Users created but missing profile information
Solution: Different OAuth providers return different user metadata. The plugin tries to extract:
- Full name from various fields
- First/last name
- Email (always required)
If profile info is missing, the provider may not be sharing it. Check provider settings in Supabase.
WordPress.com Specific Notes
Why doesn't it work on WordPress.com?
WordPress.com (especially managed hosting) has several restrictions that can affect plugin functionality:
- Script Loading: WordPress.com may modify how scripts are loaded for performance
- Caching: Aggressive caching can serve old CSS/JS files
- Security: Some inline scripts may be blocked or modified
- CDN: External resources might be proxied or blocked
Fixes Applied (v0.1.1)
This plugin has been updated specifically for WordPress.com compatibility:
- Improved script registration: Uses proper WordPress enqueue system with fallbacks
- Better dependency management: Ensures Supabase library loads before plugin scripts
- Multiple loading strategies: Primary enqueue + inline fallback + delayed retry
- Enhanced CSS specificity: Uses
!importantto override theme conflicts - Debug logging: Add
?lws_debug=1to see what's happening
Recommended WordPress.com Settings
- Disable Jetpack's "Speed up image load times" temporarily during testing
- Clear cache after any plugin updates
- Use a simple theme during initial testing to rule out theme conflicts
Development
Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Active Supabase project with OAuth providers configured
File Structure
login-with-supabase/
├── login-with-supabase.php # Main plugin file
├── README.md # This file
├── includes/
│ ├── class-lws-admin.php # Admin settings interface
│ └── class-lws-frontend.php # Frontend functionality
└── assets/
├── css/
│ └── front.css # Button and UI styles
└── js/
└── front.js # OAuth and UI logic
Hooks
Actions:
lws_user_authenticated- Fired after user authenticates (passes user ID and Supabase user data)lws_new_user_created- Fired when a new user is created (passes user ID and Supabase user data)
Filters: None currently, but let us know if you need any!
Security
- Uses WordPress nonces for REST API requests
- Validates OAuth tokens server-side
- Sanitizes all user input
- Uses WordPress's secure password generation
- No passwords stored for OAuth users (random, secure passwords assigned)
Support
If you encounter issues:
- Enable debug mode:
?lws_debug=1 - Check browser console for
[LWS]messages - Check WordPress debug log for PHP errors
- Verify Supabase configuration
- Test with default WordPress theme and no other plugins
Changelog
1.0.0 (2026-02-19)
- Fixed: Re-login issue after logout in the same browser session
- Session tracking keys are now properly cleared on logout
- Added cleanup of stale sync tracking keys on script initialization
- Improved session management to prevent duplicate login attempts
- Enhanced reliability for users who log out and immediately log back in
0.1.6 (2026-02-08)
- Added icon shortcode
[lws provider="azure"]for compact login buttons - Support for 12+ provider icons with proper branding
- Icon shortcode works in WordPress navigation menus (FSE and Classic)
- Transparent background with subtle hover effects for icons
- Three size options: small, medium, large
- Custom tooltip support for accessibility
- Automatic shortcode processing in navigation blocks
- Fixed duplicate icon rendering issue
- Added custom nav menu meta box for easy icon insertion
0.1.5 (2026-02-08)
- Added WooCommerce integration support
- New option to display login buttons on WooCommerce login and register forms
- Buttons appear on
/my-accountand other WooCommerce account pages - Full-width buttons on WooCommerce forms for better mobile experience
- Updated debug shortcode to show WooCommerce status
0.1.4 (2026-02-08)
- Added Sensei LMS integration support
- New option to display login buttons on Sensei login and register forms
- Automatic detection and integration with Sensei LMS
- Improved styling for Sensei forms integration
- Full-width buttons on Sensei forms for better mobile experience
0.1.1 (2026-01-30)
- Fixed script loading issues on WordPress.com hosting
- Improved icon injection reliability
- Added fallback loading mechanisms
- Enhanced CSS specificity to prevent theme conflicts
- Added comprehensive debug logging
- Better error handling and retry logic
- Multiple initialization strategies for reliability
0.1.0
- Initial release
- Support for multiple OAuth providers
- Automatic user creation and sync
- Shortcode support
- Admin configuration interface
License
MIT License - Feel free to use and modify as needed.
Credits
Built by Zhe Xu Powered by Supabase
A provider-agnostic WordPress plugin that authenticates users against Supabase Auth and provisions local WordPress accounts on first login.
Setup
- Activate Login with Supabase from Plugins.
- Navigate to Settings → Login with Supabase and configure:
- Supabase Project URL (e.g.
https://project.supabase.co). - Supabase Anon Key (required).
- Supabase Service Role Key (optional, only needed for advanced provider checks).
- Post-login Redirect URL to control where users land after sign-in.
- Enabled OAuth Providers: list each Supabase provider slug on its own line (examples:
azure,google,github,gitlab,facebook,apple). Buttons render in the order entered. - Toggle whether to display buttons on the core
wp-login.phpform.
- Supabase Project URL (e.g.
- In Supabase, enable each provider you listed and register the callback URL that points to the WordPress page containing the login shortcode (for example,
https://domain.com/login/).
Usage
-
Embed Supabase login buttons anywhere with either shortcode:
[login_with_supabase][supabase_login layout="horizontal"]Use
layout="horizontal"to render a single row; default is stacked vertically. -
The plugin also injects the buttons on
wp-login.phpwhen enabled in settings.
What happens on login?
- The JavaScript bundle launches
signInWithOAuthfor the selected provider. - Supabase completes the external OAuth flow and returns to WordPress.
- The plugin exchanges the Supabase session via a REST endpoint, creates the WordPress account if needed, and issues standard WordPress auth cookies.
- Metadata is stored on the user:
lws_supabase_uuid(Supabase user ID) andlws_supabase_provider(provider slug).
Hooks
lws_user_authenticated( int $user_id, array $supabase_user )fires after the user is logged in.lws_new_user_created( int $user_id, array $supabase_user )fires after a new WordPress account is provisioned.