github clerk/javascript @clerk/fastify@2.4.0

latest releases: @clerk/types@4.92.0, @clerk/clerk-js@5.99.0, @clerk/fastify@2.4.37...
4 months ago

Minor Changes

  • 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. (#6067) by @wobsoriano

    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 Fastify from 'fastify';
    import { getAuth } from '@clerk/fastify';
    
    const fastify = Fastify();
    
    fastify.get('/path', (request, reply) => {
      const authObject = getAuth(req, { acceptsToken: 'any' });
    
      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);
      }
    });

Patch Changes

Don't miss a new javascript release

NewReleases is sending notifications on new releases.