Skip to content

Conversation

@github-actions
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@hono/[email protected]

Minor Changes

  • #1664 293e98978c2676e0546d3fdbfe8c8bc6db54d064 Thanks @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:

    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)
      }
    })

@yusukebe yusukebe merged commit 2f5e35e into main Jan 16, 2026
@yusukebe yusukebe deleted the changeset-release/main branch January 16, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants