Skip to content

New WP user whose email already exists in WorkOS stays unlinked silently #59

Open

Description

@bordoni

When WordPress creates a user whose email already belongs to a WorkOS user (a guest checkout, an import, an admin creating the account), push_user_to_workos() gets email_not_available back from WorkOS and only logs it. The WordPress user stays unlinked until that person signs in. Anything that needs the WorkOS ID before that (licensing, entitlements) quietly skips.

sync_existing_user() has the same gap.

Fix

  • On email_not_available:
    • look up the existing WorkOS user by email;
    • store it on the WordPress user as a pending match, not a link (e.g. _workos_pending_match = WorkOS ID + time). The plugin must not link by email without the person proving they own it; Re-link Protection still applies.
    • fire workos_user_push_failed( $user_id, WP_Error $error, ?string $existing_workos_id ) so the site can tell the customer to sign in with their existing account;
    • log it.
  • When that user later signs in and links, clear the pending marker. workos_user_linked already fires there.
  • Both create paths send email_verified => true for every new WordPress user, even when nobody verified the address. Add a workos_push_user_email_verified( bool $verified, int $user_id, array $userdata ) filter. The default stays true in 1.0.11, so behaviour doesn't change in a patch release. Whether to flip the default goes to 1.1.0.

Done when

  • Tests cover the pending marker, the action and its arguments, clearing on link, and the new filter.

Activity

  1. added this to the 1.0.11 milestone on Oct 17, 2026
  2. added
    bugSomething isn't working
    area: authAuthentication / AuthKit / Login Profiles
    on Oct 17, 2026
  3. modified the milestones: 1.0.11, 1.0.12 on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: authAuthentication / AuthKit / Login ProfilesbugSomething isn't working

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions