Skip to content

December 25, 2024

Latest
Compare
Choose a tag to compare
@theguild-bot theguild-bot released this 25 Dec 08:36
982c3c7

@graphql-mesh/[email protected]

Minor Changes

  • #8189
    83a73ab
    Thanks @jjangga0214! -
    #3590 Do not throw when `request` is not
    available in the context, it can be a WebSockets connection

    • Export helper extractFromConnectionParams to get the token from WebSocket connectionParams
      when GraphQL WS is used like
      here
    import {
      defineConfig,
      extractFromConnectionParams,
      extractFromHeader,
      useJWT
    } from '@graphql-hive/gateway'
    
    export const gatewayConfig = defineConfig({
      jwt: {
        // So it will look for the token in the connectionParams.my-token field in case of a WebSockets connection
        // It will check WS params and headers, and get the available one
        lookupLocations: [
          extractFromConnectionParams({ name: 'my-token' }),
          extractFromHeader({ name: 'authorization', prefix: 'Bearer ' })
        ]
      }
    })