Skip to content

Comments

Improve DX : remove useEphemeralSession() and expose asProvider() publicly#1090

Draft
sanchitmehtagit wants to merge 1 commit intodevelop/v3.0from
SDK-7776
Draft

Improve DX : remove useEphemeralSession() and expose asProvider() publicly#1090
sanchitmehtagit wants to merge 1 commit intodevelop/v3.0from
SDK-7776

Conversation

@sanchitmehtagit
Copy link
Contributor

Summary

Removes the useEphemeralSession() method and exposes WebAuthentication.asProvider(ephemeralSession:) as public API to resolve a critical API design flaw where mutually exclusive methods could be used together.

Problem

The Web Auth builder allowed calling mutually exclusive methods without warning:

Auth0
    .webAuth()
    .useEphemeralSession()  // Sets internal flag
    .provider(WebAuthentication.safariProvider())  // Overrides provider completely
    .start { }

Result: The ephemeral session configuration is silently ignored. No compiler error, no runtime warning—just unexpected behavior that's difficult to debug.

Solution

Remove useEphemeralSession() and expose the default provider explicitly:

// Before (v2)
Auth0.webAuth().useEphemeralSession().start { }

// After (v3)
Auth0.webAuth().provider(WebAuthentication.asProvider(ephemeralSession: true)).start { }

Why This Matters

  1. Type Safety - Impossible to configure conflicting options
  2. Explicit Intent - Code is self-documenting
  3. Consistency - Matches pattern used by safariProvider()
  4. Discoverability - Users see asProvider() in autocomplete alongside other providers

Changes

  • Removed useEphemeralSession() from WebAuth protocol and Auth0WebAuth
  • Exposed WebAuthentication.asProvider(ephemeralSession:) as public API
  • Updated all documentation (EXAMPLES.md, FAQ.md, UserAgents.md)
  • Added comprehensive migration guide entry
  • Cleaned up tests

@sanchitmehtagit sanchitmehtagit requested a review from a team as a code owner February 18, 2026 11:52
@sanchitmehtagit sanchitmehtagit marked this pull request as draft February 18, 2026 11:53
@sanchitmehtagit sanchitmehtagit changed the title DX improvements: Remove useEphemeralSession() and expose asProvider() publicly Improve DX : Remove useEphemeralSession() and expose asProvider() publicly Feb 18, 2026
@sanchitmehtagit sanchitmehtagit changed the title Improve DX : Remove useEphemeralSession() and expose asProvider() publicly Improve DX : remove useEphemeralSession() and expose asProvider() publicly Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant