Skip to content

id_token lacks email claim for non-provider sessions, creating duplicate planner members #87

Description

@mroderick

Users signing in through the planner's codebar login could be dropped into a brand-new, empty account — no subscriptions, no roles — because the planner received an id_token without an email claim.

Timeline (2026-10-02)

  • 10:01 UTC — auth release v64 deployed better-auth 1.6.27 → 1.7.5
  • 13:18 UTC — first affected sign-in: planner created duplicate member 31450
  • 15:06 UTC — second affected sign-in: planner created duplicate member 31452; reported by the member's organiser
  • 16:34 UTC — mitigated by rolling back to the v63 code (release v65)

Mechanism

Two independent behaviours combine:

  1. better-auth 1.7 stopped including user-record claims (email, name) in the id_token for sessions not created through a social provider (magic-link sessions). The claims hook receives the full user record and the correct scopes, but the claims are absent from the signed token.
  2. The planner resolves members by the id_token's email claim and falls back to sub when the claim is absent (email = payload['email'] || payload['sub'] in lib/omniauth/strategies/codebar.rb). With the claim missing, the fallback creates a member whose email and name are the better-auth user id — an opaque 32-character id. Nothing matches the real account, so member:duplicates:detect finds nothing.

Fix

Follow-ups

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions