# @hono/clerk-auth

## 3.1.1

### Patch Changes

- [#1843](https://github.com/honojs/middleware/pull/1843) [`d8de66af04ea218148982d097f2a96fec1d60da8`](https://github.com/honojs/middleware/commit/d8de66af04ea218148982d097f2a96fec1d60da8) Thanks [@wobsoriano](https://github.com/wobsoriano)! - Deprecate `@hono/clerk-auth` in favor of the official `@clerk/hono` package. To migrate, update your imports:

  ```diff
  - import { clerkMiddleware, getAuth } from '@hono/clerk-auth'
  + import { clerkMiddleware, getAuth } from '@clerk/hono'
  ```

## 3.1.0

### Minor Changes

- [#1664](https://github.com/honojs/middleware/pull/1664) [`293e98978c2676e0546d3fdbfe8c8bc6db54d064`](https://github.com/honojs/middleware/commit/293e98978c2676e0546d3fdbfe8c8bc6db54d064) Thanks [@wobsoriano](https://github.com/wobsoriano)! - Introduces machine authentication, supporting four token types: `api_key`, `oauth_token`, `machine_token`, and `session_token`. For backwards compatibility, `session_token` remains the default when no token type is specified. This enables machine-to-machine authentication and use cases such as API keys and OAuth integrations. Existing applications continue to work without modification.

  You can specify which token types are allowed by using the `acceptsToken` option in the `getAuth()` function. This option can be set to a specific type, an array of types, or `'any'` to accept all supported tokens.

  Example usage:

  ```ts
  import { clerkMiddleware, getAuth } from '@hono/clerk-auth'
  import { Hono } from 'hono'

  const app = new Hono()

  app.use('*', clerkMiddleware())
  app.get('/api/protected', (c) => {
    const auth = getAuth(c, { acceptsToken: 'any' })

    if (!auth.isAuthenticated) {
      // do something for unauthenticated requests
    }

    if (authObject.tokenType === 'session_token') {
      console.log('this is session token from a user')
    } else {
      console.log('this is some other type of machine token')
      console.log('more specifically, a ' + authObject.tokenType)
    }
  })
  ```

## 3.0.3

### Patch Changes

- [#1336](https://github.com/honojs/middleware/pull/1336) [`59846c9eddf79fae5a288c3aa5c98a1853e406fd`](https://github.com/honojs/middleware/commit/59846c9eddf79fae5a288c3aa5c98a1853e406fd) Thanks [@BarryThePenguin](https://github.com/BarryThePenguin)! - Publish to JSR

## 3.0.2

### Patch Changes

- [#1295](https://github.com/honojs/middleware/pull/1295) [`0f472345c737ed054bf26c2e0ab13d71dc0fcbcd`](https://github.com/honojs/middleware/commit/0f472345c737ed054bf26c2e0ab13d71dc0fcbcd) Thanks [@brkalow](https://github.com/brkalow)! - Upgrade clerk dependencies.

## 3.0.1

### Patch Changes

- [#1262](https://github.com/honojs/middleware/pull/1262) [`f611394629df8825972c24de944e9bc727bf610d`](https://github.com/honojs/middleware/commit/f611394629df8825972c24de944e9bc727bf610d) Thanks [@RasengunShotaro](https://github.com/RasengunShotaro)! - updated clerk dependency

## 3.0.0

### Major Changes

- [#1190](https://github.com/honojs/middleware/pull/1190) [`6ca78a14dad67d7920a7c70bbfdb752eeaaff9ad`](https://github.com/honojs/middleware/commit/6ca78a14dad67d7920a7c70bbfdb752eeaaff9ad) Thanks [@wobsoriano](https://github.com/wobsoriano)! - Move `@clerk/backend` from peerDependencies to dependencies and bump to `2.x.x`.

  This change ensures the package is directly available without requiring consumers to install it separately. The version bump includes the upcoming machine authentication feature while maintaining backward compatibility.

## 2.0.1

### Patch Changes

- [#1194](https://github.com/honojs/middleware/pull/1194) [`683455895d35de50bd5c4cc60c0d764b99a8c8ec`](https://github.com/honojs/middleware/commit/683455895d35de50bd5c4cc60c0d764b99a8c8ec) Thanks [@BarryThePenguin](https://github.com/BarryThePenguin)! - Add explicit `MiddlewareHandler` return type

## 2.0.0

### Major Changes

- [#465](https://github.com/honojs/middleware/pull/465) [`1823a2862744628143ee78bf06c0df3a99d22209`](https://github.com/honojs/middleware/commit/1823a2862744628143ee78bf06c0df3a99d22209) Thanks [@MonsterDeveloper](https://github.com/MonsterDeveloper)! - Migrate to Clerk Core v2

## 1.0.3

### Patch Changes

- [#463](https://github.com/honojs/middleware/pull/463) [`892ea7da85fb2c799eacc4d29651e1fa45a6aec0`](https://github.com/honojs/middleware/commit/892ea7da85fb2c799eacc4d29651e1fa45a6aec0) Thanks [@yudai-nkt](https://github.com/yudai-nkt)! - Update peer dependencies so that newer validators can be installed.

## 1.0.2

### Patch Changes

- [#460](https://github.com/honojs/middleware/pull/460) [`6497f5772f84027a07ef2c728cb10b2f8a172dda`](https://github.com/honojs/middleware/commit/6497f5772f84027a07ef2c728cb10b2f8a172dda) Thanks [@hadeeb](https://github.com/hadeeb)! - fix: export esm

## 1.0.1

### Patch Changes

- [#380](https://github.com/honojs/middleware/pull/380) [`ea19f6bdeb14216da0880baf5dd5885395c0f008`](https://github.com/honojs/middleware/commit/ea19f6bdeb14216da0880baf5dd5885395c0f008) Thanks [@CarlosZiegler](https://github.com/CarlosZiegler)! - fix: change peer dependency to support v4.0.0

## 1.0.0

### Major Changes

- [#151](https://github.com/honojs/middleware/pull/151) [`a18da2a`](https://github.com/honojs/middleware/commit/a18da2a5456e7d4ec407569d202a0754df3ae472) Thanks [@octoper](https://github.com/octoper)! - Added Clerk Middleware
