mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #727] Authentication on Vinext: pain points and a community solution (VinextAuth) #157
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @diogopaesdev on GitHub (Mar 31, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/727
The problem
One of the first questions developers hit when adopting Vinext is:
how do I add authentication?
The natural answer — NextAuth v4 — doesn't work. NextAuth depends
on
Node.js APIs (
crypto,fs, cookies vianext/headers) thataren't
available in the Cloudflare Workers runtime. The result is a
runtime
crash the moment you try to use it.
There's currently no documentation, guide, or example in this repo
addressing auth.
What we built
We built VinextAuth — a drop-in replacement for NextAuth v4
designed
specifically for Vinext + Cloudflare Workers.
Key design decisions:
exclusively
interface, same
useSession/signIn/signOuthooksCloudflare KV adapter for server-side sessions
Apple,
Twitter/X, Facebook, LinkedIn, Spotify, Twitch, Email (magic
link),
Credentials
provider
out of the box
```ts
import VinextAuth from 'vinextauth';
import { Google } from 'vinextauth/providers/google';
export const { handlers, auth, signIn, signOut } = VinextAuth({
providers: [
Google({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
}),
],
});
```
vinextauthWhy this matters for Vinext
Auth is a prerequisite for almost every real-world app. Without a
working solution, the "try Vinext on your Next.js app" pitch breaks
at the first protected route.
Open questions / possible next steps
solutions
in the README or docs?
(first-party
or recommended third-party)?
cookies(),headers()) thatcould
be improved to make auth adapters easier to build?
Happy to answer questions or contribute further.
@james-elicx commented on GitHub (Mar 31, 2026):
I would recommend using Better Auth - it generally works across every framework and runtime, and we run tests with their library.
Next Auth / Auth.js joined Better Auth last year and recommend using Better Auth for projects instead of Next Auth.