-
Notifications
You must be signed in to change notification settings - Fork 340
feat(nextjs): Introduce machine authentication #5710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far
ba2f2aa
to
d0bab9b
Compare
5e0630b
to
69e9760
Compare
26ea907
to
58c0c97
Compare
!snapshot |
Hey @wobsoriano - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
}) => | ||
withLogger(debugLoggerName, logger => { | ||
return (req: RequestLike, opts?: { secretKey?: string }): AuthObject => { | ||
return (req: RequestLike, opts?: { secretKey?: string }): SignedInAuthObject | SignedOutAuthObject => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since getAuth()
does not have machine auth feature yet (will be breaking because it's async), we need to type it as session auth
})(req, {} as NextFetchEvent); | ||
|
||
expect(resp?.status).toEqual(401); | ||
expect(resp?.headers.get('WWW-Authenticate')).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 it might be a good idea to assert on the explicit value here, instead of just the truthy check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
Description
This is a companion PR to #5689, that updates the Next.js SDK
clerkMiddleware()
,auth()
, andauth.protect()
helpers to accommodate machine auth tokens.Key changes:
auth()
to accept aacceptTokens
param. Useful for leaf node route protection.auth.protect()
to accept atokens
param. Useful in protecting routes inside a middleware.clerkMiddleware()
to passany
as the defaultacceptsToken
type toauthenticateRequest
. This however opens up an opportunity for an economic attacks and will be tackled in a separate PR.Resolves ROBO-114 and ROBO-134
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change