Skip to content

Commit 38310af

Browse files
ci(repo): Version packages
1 parent 35c5bea commit 38310af

File tree

5 files changed

+35
-38
lines changed

5 files changed

+35
-38
lines changed

.changeset/deprecate-require-auth.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

.changeset/grumpy-stamps-clap.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

.changeset/renovate-config-migration.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/express/CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
# Change Log
22

3+
## 2.1.0
4+
5+
### Minor Changes
6+
7+
- Deprecated `requireAuth()` middleware. It will be removed in the next major version. ([#8241](https://github.com/clerk/javascript/pull/8241)) by [@wobsoriano](https://github.com/wobsoriano)
8+
9+
The `requireAuth()` middleware redirects unauthenticated requests to a sign-in page, which is often unexpected for API routes where a 401 response is more appropriate. Use `clerkMiddleware()` with `getAuth()` instead for explicit control over authentication behavior.
10+
11+
**Before (deprecated):**
12+
13+
```js
14+
import { requireAuth } from '@clerk/express';
15+
16+
app.get('/api/protected', requireAuth(), (req, res) => {
17+
// handle authenticated request
18+
});
19+
```
20+
21+
**After (recommended):**
22+
23+
```js
24+
import { clerkMiddleware, getAuth } from '@clerk/express';
25+
26+
app.use(clerkMiddleware());
27+
28+
app.get('/api/protected', (req, res) => {
29+
const { userId } = getAuth(req);
30+
if (!userId) {
31+
return res.status(401).json({ error: 'Unauthorized' });
32+
}
33+
// handle authenticated request
34+
});
35+
```
36+
337
## 2.0.11
438

539
### Patch Changes

packages/express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clerk/express",
3-
"version": "2.0.11",
3+
"version": "2.1.0",
44
"description": "Clerk server SDK for usage with Express",
55
"keywords": [
66
"clerk",

0 commit comments

Comments
 (0)