Skip to content

Commit 608ec63

Browse files
committed
Merge branch 'feature/authkit-custom-paths-shortcode' into main
2 parents 3c7bacb + 76c9d3a commit 608ec63

11 files changed

Lines changed: 31 additions & 74 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Per-environment constants (take priority over generic):
100100
| `src/WorkOS/Auth/AuthKit/LoginCompleter.php` | Post-auth finalizer (EntitlementGate + MFA policy) |
101101
| `src/WorkOS/Auth/AuthKit/LoginTakeover.php` | wp-login.php `action=login` takeover |
102102
| `src/WorkOS/Auth/AuthKit/FrontendRoute.php` | `/workos/login/{profile}` rewrite + static `register_rewrite()` |
103-
| `src/WorkOS/Auth/AuthKit/Shortcode.php` | `[workos_login_v2]` shortcode |
103+
| `src/WorkOS/Auth/AuthKit/Shortcode.php` | `[workos:login]` shortcode |
104104
| `src/WorkOS/Auth/AuthKit/Renderer.php` | HTML shell + React bundle enqueue. Fires `workos_authkit_enqueue_assets` action and applies `workos_authkit_branding` / `workos_authkit_profile_data` / `workos_authkit_body_classes` filters — see `docs/extending-the-login-ui.md` |
105105
| `src/WorkOS/Auth/AuthKit/Nonce.php` | Profile-scoped CSRF nonces |
106106
| `src/WorkOS/Auth/AuthKit/RateLimiter.php` | Per-IP / per-email transient buckets |
@@ -114,8 +114,7 @@ Per-environment constants (take priority over generic):
114114
| `src/WorkOS/ActivityLog/EventLogger.php` | Logs WordPress events to local DB table |
115115
| `src/WorkOS/ActivityLog/AdminPage.php` | Activity log viewer in admin |
116116
| **UI (Login Button)** | |
117-
| `src/WorkOS/UI/Controller.php` | UI controller, registers shortcode/block/widget |
118-
| `src/WorkOS/UI/Shortcode.php` | `[workos_login]` shortcode |
117+
| `src/WorkOS/UI/Controller.php` | UI controller, registers block/widget |
119118
| `src/WorkOS/UI/Block.php` | Gutenberg block registration |
120119
| `src/WorkOS/UI/Widget.php` | Classic widget |
121120
| `src/WorkOS/UI/Renderer.php` | Shared login button renderer |

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ browser only ever talks to `/wp-json/workos/v1/auth/*`.
2121
`logout`, `register`, `lostpassword`, `resetpass`, `confirmaction`,
2222
`postpass`, `?fallback=1`, `?workos=0` still pass through to WP
2323
defaults.
24-
- **Entry points**`[workos_login_v2]` shortcode, `workos/login-form`
25-
block, and `/workos/login/{profile}` rewrite all render the same
26-
shell.
24+
- **Entry points**`[workos:login]` shortcode and
25+
`/workos/login/{profile}` rewrite both render the same shell.
2726
- **Profile routing rules** — ordered `redirect_to` glob /
2827
`referrer_host` / `user_role` matchers pick which profile applies to
2928
a request; first match wins, falls back to the `default` profile.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Enterprise identity management for WordPress powered by [WorkOS](https://workos.
1010

1111
### Custom AuthKit (WordPress-hosted login)
1212

13-
- **React login shell** on wp-login.php, `[workos_login_v2]` shortcode, `workos/login-form` block, and a dedicated `/workos/login/{profile}` route — all driven by the same TypeScript bundle
13+
- **React login shell** on wp-login.php, `[workos:login]` shortcode, and a dedicated `/workos/login/{profile}` route — all driven by the same TypeScript bundle
1414
- **Login Profiles** — admin-defined presets (enabled methods, pinned organization, signup/invite/reset toggles, MFA policy, branding) managed through a React admin editor at **WorkOS → Login Profiles**
1515
- **Sign-in methods**: email + password, magic code, social OAuth (Google, Microsoft, GitHub, Apple), passkey
1616
- **In-app flows**: self-serve sign-up with email verification, invitation acceptance, password reset
@@ -28,7 +28,7 @@ Enterprise identity management for WordPress powered by [WorkOS](https://workos.
2828
- **Entitlement Gate** — require organization membership to log in
2929
- **Webhook Processing** — real-time sync of user, organization, and directory events
3030
- **REST API Authentication** — Bearer token auth for headless/decoupled WordPress
31-
- **Legacy Login Button**shortcode (`[workos_login]`), Gutenberg block, and classic widget (AuthKit-redirect flow)
31+
- **Legacy Login Button** — Gutenberg block and classic widget (AuthKit-redirect flow)
3232
- **Login Bypass** — access the native WordPress login form via `?fallback=1` when WorkOS is unavailable
3333
- **Activity Logging** — local database table with admin viewer for tracking authentication and sync events
3434
- **Audit Logging** — forward WordPress events (login, logout, post changes, user changes) to WorkOS Audit Logs
@@ -105,11 +105,11 @@ renders in its place. All other actions — `logout`, `register`,
105105
`?workos=0` — pass through to core WP so WooCommerce, WP-CLI password
106106
resets, and email confirmation links keep working.
107107

108-
The shell also mounts on `[workos_login_v2 profile="slug"]`, a `workos/login-form`
109-
Gutenberg block, and the `/workos/login/{profile}` rewrite. Every mount
110-
reads configuration from `data-*` attributes emitted by `Auth\AuthKit\Renderer`
111-
and talks to `/wp-json/workos/v1/auth/*` for everything — no WorkOS calls
112-
are proxied through the browser.
108+
The shell also mounts on `[workos:login profile="slug"]` and the
109+
`/workos/login/{profile}` rewrite. Every mount reads configuration from
110+
`data-*` attributes emitted by `Auth\AuthKit\Renderer` and talks to
111+
`/wp-json/workos/v1/auth/*` for everything — no WorkOS calls are proxied
112+
through the browser.
113113

114114
### AuthKit-Redirect Mode (legacy)
115115

@@ -761,7 +761,7 @@ src/WorkOS/
761761
LoginCompleter.php # Shared post-auth finalizer (entitlement + MFA)
762762
LoginTakeover.php # wp-login.php takeover (action=login only)
763763
FrontendRoute.php # /workos/login/{profile} rewrite
764-
Shortcode.php # [workos_login_v2] shortcode
764+
Shortcode.php # [workos:login] shortcode
765765
Renderer.php # HTML shell + bundle enqueue
766766
Nonce.php # Profile-scoped CSRF nonces
767767
RateLimiter.php # Per-IP / per-email transient buckets

docs/extending-the-login-ui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The `integration-workos` plugin renders its login screen as a single-page React
66
2. **`workos_authkit_enqueue_assets` action** — enqueue per-profile CSS and/or JavaScript files alongside the AuthKit bundle.
77
3. **PHP filters** — last-mile mutation of the data the shell renders.
88

9-
The same surfaces are available everywhere the AuthKit shell appears: the wp-login.php takeover, the `[workos_login_v2]` shortcode, the `workos/login-form` block, and the `/workos/login/{slug}` rewrite.
9+
The same surfaces are available everywhere the AuthKit shell appears: the wp-login.php takeover, the `[workos:login]` shortcode, and the `/workos/login/{slug}` rewrite.
1010

1111
---
1212

readme.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Integration with WorkOS connects your WordPress site with [WorkOS](https://worko
2323

2424
= Custom AuthKit =
2525

26-
* **WordPress-hosted React login** — no redirect to WorkOS for password, magic code, signup, invitation, or MFA. Mounts on wp-login.php, a shortcode (`[workos_login_v2]`), a Gutenberg block, and a dedicated `/workos/login/{profile}` route.
26+
* **WordPress-hosted React login** — no redirect to WorkOS for password, magic code, signup, invitation, or MFA. Mounts on wp-login.php, a shortcode (`[workos:login]`), and a dedicated `/workos/login/{profile}` route.
2727
* **Login Profiles** — admin-defined presets (enabled sign-in methods, pinned organization, signup/invite toggles, MFA policy, branding) edited from **WorkOS → Login Profiles**. The organization picker loads live from WorkOS so admins pick an org by name instead of pasting raw IDs.
2828
* **Sign-in methods** — email + password, magic code, social OAuth (Google, Microsoft, GitHub, Apple), and passkey. Each profile chooses its own subset.
2929
* **MFA** — TOTP, SMS, and WebAuthn/passkey with in-app enrollment + challenge. Profile-level `mfa.enforce` (`never`/`if_required`/`always`) and factor allowlist are applied at login time.
@@ -35,7 +35,7 @@ Integration with WorkOS connects your WordPress site with [WorkOS](https://worko
3535

3636
* **Single Sign-On (SSO)** — legacy AuthKit redirect mode, per-profile selectable for SAML/OIDC connections.
3737
* **Headless mode** — intercept WordPress's `authenticate` filter for custom login forms.
38-
* **Legacy Login Button** — Shortcode (`[workos_login]`), Gutenberg block, and classic widget (AuthKit-redirect flow).
38+
* **Legacy Login Button** — Gutenberg block and classic widget (AuthKit-redirect flow).
3939
* **Login Bypass** — Access the native WordPress login form via `?fallback=1` when WorkOS is unavailable.
4040
* **Password Reset Integration** — Redirect password reset to WorkOS or fall back to WordPress.
4141
* **Registration Redirect** — Redirect registration to WorkOS AuthKit.
@@ -86,11 +86,11 @@ Yes, if "Password Fallback" is enabled in settings. Users can access the standar
8686

8787
= How do I add a login button to my site? =
8888

89-
Use the `[workos_login]` shortcode, add the "WorkOS Login" Gutenberg block, or use the "WorkOS Login" classic widget. All three render a styled login button that redirects to WorkOS AuthKit.
89+
Add the "WorkOS Login" Gutenberg block or use the "WorkOS Login" classic widget. Both render a styled login button that redirects to WorkOS AuthKit.
9090

9191
= How do I show the new WordPress-hosted login (Custom AuthKit) on a page? =
9292

93-
Use `[workos_login_v2 profile="your-profile-slug"]`, add the "WorkOS Login Form" block, or link to `/workos/login/{profile}`. All three mount the same React shell. The reserved `default` Login Profile automatically takes over wp-login.php.
93+
Use `[workos:login profile="your-profile-slug"]` or link to `/workos/login/{profile}`. Both mount the same React shell. The reserved `default` Login Profile automatically takes over wp-login.php.
9494

9595
= Can different login pages offer different sign-in methods? =
9696

@@ -169,7 +169,7 @@ WorkOS is provided by WorkOS, Inc.
169169
= 1.0.0 - 2026-04-23 =
170170

171171
Custom AuthKit (WordPress-hosted login):
172-
* React login shell on wp-login.php, `[workos_login_v2]` shortcode, `workos/login-form` block, and `/workos/login/{profile}` route.
172+
* React login shell on wp-login.php, `[workos:login]` shortcode, and `/workos/login/{profile}` route.
173173
* Login Profiles — admin-defined presets for enabled methods, pinned organization, signup/invite/reset flows, MFA policy, and branding, managed at WorkOS → Login Profiles.
174174
* Pinned-organization picker in the Profile editor reads live from WorkOS (with a "Custom ID…" fallback for legacy or unlisted orgs), and the Profiles list renders organization names instead of raw IDs.
175175
* Sign-in methods: email + password, magic code, social OAuth (Google, Microsoft, GitHub, Apple), passkey.
@@ -189,7 +189,7 @@ Base platform:
189189
* Entitlement gate — require organization membership to log in.
190190
* Webhook processing for user, organization, directory, membership, and connection events.
191191
* REST API Bearer token authentication using WorkOS access tokens.
192-
* Legacy login button shortcode (`[workos_login]`), Gutenberg block, and classic widget.
192+
* Legacy login button Gutenberg block and classic widget (AuthKit-redirect flow).
193193
* Login bypass via `?fallback=1` for native WordPress login when WorkOS is unavailable.
194194
* Activity logging with local database table and admin viewer.
195195
* Audit logging — forward WordPress events to WorkOS Audit Logs.

src/WorkOS/Auth/AuthKit/ProfileRouter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* Note on missing profiles: `resolve()` always returns a usable Profile,
3030
* never null — a request for an unknown slug (`/workos/login/nonexistent`
31-
* or `[workos_login_v2 profile="typo"]`) falls through to the default
31+
* or `[workos:login profile="typo"]`) falls through to the default
3232
* profile rather than 404ing. This is deliberate: the default profile's
3333
* existence is not a secret, and most mis-typed references are genuine
3434
* configuration mistakes that are easier to debug when the UI still

src/WorkOS/Auth/AuthKit/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Shared across every entry point that surfaces the AuthKit UI:
1616
*
1717
* - wp-login.php takeover (full-page chrome we control ourselves)
18-
* - `[workos_login]` shortcode / Gutenberg block (inline card)
18+
* - `[workos:login]` shortcode (inline card)
1919
* - `/workos/login/{profile}` rewrite (full-bleed template)
2020
* - Admin Profile Editor (via a different React bundle in Phase 5)
2121
*

src/WorkOS/Auth/AuthKit/Shortcode.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* [workos_login] shortcode (Custom AuthKit).
3+
* [workos:login] shortcode.
44
*
55
* @package WorkOS\Auth\AuthKit
66
*/
@@ -12,13 +12,12 @@
1212
/**
1313
* Renders the AuthKit React shell inline at the shortcode location.
1414
*
15-
* This is the Custom-AuthKit shortcode (a new, differentiated short tag
16-
* `[workos_login_v2]`) — the legacy `[workos_login]` shortcode keeps
17-
* behaving as it always did (button-to-AuthKit-redirect) for back-compat.
15+
* The tag uses the `workos:` colon namespace so all plugin-provided
16+
* shortcodes share a single, scannable prefix.
1817
*/
1918
class Shortcode {
2019

21-
public const TAG = 'workos_login_v2';
20+
public const TAG = 'workos:login';
2221

2322
/**
2423
* Profile router.

src/WorkOS/UI/Controller.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* UI Controller — registers shortcode, widget, block, AJAX, and frontend assets.
3+
* UI Controller — registers widget, block, AJAX, and frontend assets.
44
*
55
* @package WorkOS\UI
66
*/
@@ -22,9 +22,6 @@ class Controller extends BaseController {
2222
* @return void
2323
*/
2424
protected function doRegister(): void {
25-
$this->container->singleton( Shortcode::class );
26-
$this->container->get( Shortcode::class );
27-
2825
$this->container->singleton( Block::class );
2926
$this->container->get( Block::class );
3027

@@ -57,16 +54,15 @@ public function register_widget(): void {
5754
/**
5855
* Conditionally enqueue frontend assets.
5956
*
60-
* Only loads CSS/JS when the login button is actually used on the page.
57+
* Only loads CSS/JS when the login button block or widget is on the page.
6158
*/
6259
public function maybe_enqueue_frontend_assets(): void {
6360
global $post;
6461

65-
$has_shortcode = $post instanceof \WP_Post && has_shortcode( $post->post_content, 'workos_login' );
66-
$has_block = $post instanceof \WP_Post && has_block( 'workos/login-button', $post );
67-
$has_widget = is_active_widget( false, false, 'workos_login_button' );
62+
$has_block = $post instanceof \WP_Post && has_block( 'workos/login-button', $post );
63+
$has_widget = is_active_widget( false, false, 'workos_login_button' );
6864

69-
if ( ! $has_shortcode && ! $has_block && ! $has_widget ) {
65+
if ( ! $has_block && ! $has_widget ) {
7066
return;
7167
}
7268

src/WorkOS/UI/Shortcode.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)