
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@clerk/hono
Advanced tools
Clerk is the easiest way to add authentication and user management to your Hono application. Add sign up, sign in, and profile management to your application in minutes.
>=20.9.0 or laternpm install @clerk/hono
Set your Clerk API keys as environment variables:
CLERK_SECRET_KEY=sk_****
CLERK_PUBLISHABLE_KEY=pk_****
import { Hono } from 'hono';
import { clerkMiddleware, getAuth } from '@clerk/hono';
const app = new Hono();
// Apply Clerk middleware to all routes
app.use('*', clerkMiddleware());
// Public route
app.get('/', c => {
return c.json({ message: 'Hello!' });
});
// Protected route
app.get('/protected', c => {
const { userId } = getAuth(c);
if (!userId) {
return c.json({ error: 'Unauthorized' }, 401);
}
return c.json({ message: 'Hello authenticated user!', userId });
});
export default app;
You can access the Clerk Backend API client directly from the context:
app.get('/user/:id', async c => {
const clerkClient = c.get('clerk');
const user = await clerkClient.users.getUser(c.req.param('id'));
return c.json({ user });
});
acceptsToken for Machine Authapp.get('/api', c => {
const auth = getAuth(c, { acceptsToken: 'api_key' });
if (!auth.userId) {
return c.json({ error: 'Unauthorized' }, 401);
}
return c.json({ message: 'API access granted' });
});
import { Hono } from 'hono';
import { verifyWebhook } from '@clerk/hono/webhooks';
const app = new Hono();
app.post('/webhooks/clerk', async c => {
const evt = await verifyWebhook(c);
switch (evt.type) {
case 'user.created':
console.log('User created:', evt.data.id);
break;
// Handle other event types...
}
return c.json({ received: true });
});
You can get in touch with us in any of the following ways:
We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines and code of conduct.
@clerk/hono follows good practices of security, but 100% security cannot be assured.
@clerk/hono is provided "as is" without any warranty. Use at your own risk.
For more information and to report security issues, please refer to our security documentation.
This project is licensed under the MIT license.
See LICENSE for more information.
FAQs
Clerk SDK for Hono
We found that @clerk/hono demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.