Skip to content

feat: move auth and server helpers out of Next.js into a plain Node package #2564

Closed as not planned

Description

@josephfusco

The token exchange, refresh, and cookie handling in @faustwp/core is tied to Next.js (API routes, next/headers, the Next request/response types). Code outside Next.js (Astro, SvelteKit, a plain Node service, a CLI) can't reuse it, so each one reimplements the faustwp/v1/authorize flow.

Proposal

Extract the framework-agnostic parts into a plain Node package with no Next.js dependency:

  • Exchanging an authorization code or refresh token for tokens.
  • Refreshing tokens and tracking expiry.
  • Sending authenticated requests to WPGraphQL and REST.

@faustwp/core would then use this package and keep only the Next.js-specific glue. The roadmap's planned @wpengine/hwp-auth package looks like the right home, so this should line up with that work rather than add another package.

Acceptance

  • The package runs in plain Node with no Next.js installed.
  • @faustwp/core auth behavior is unchanged for existing users.
  • Usage is documented for a non-Next.js server.

Activity

  1. added
    [Type] Feature
    [Area] Core
    Needs Discussion
    on Oct 1, 2026
  2. self-assigned this
    on Oct 20, 2026
  3. josephfusco commented on Oct 20, 2026

    @josephfusco
    MemberAuthor

    We've decided not to build a Faust.js auth package. Existing tools already cover authentication outside Next.js, and hwptoolkit's Headless Authentication guide recommends them:

    • Server-to-server requests: WordPress's built-in Application Passwords.
    • User login from Astro, SvelteKit, a plain Node service or other runtimes: WPGraphQL Headless Login on the WordPress side, with an established auth library such as Auth.js or Better Auth in the app.

    @faustwp/core's auth for Next.js apps doesn't change. This also covers #1512, which was closed in favor of this issue.

  4. moved this from 🆕 Backlog to ✅ Closed in Headless OSSon Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Needs Discussion[Area] Core[Type] Feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions