From c0ce8e2871381439c2213d88a9384a4b25992a2c Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Sat, 22 Oct 2022 16:28:28 +0300 Subject: [PATCH] Satisfy ESM --- packages/plugins/jwt/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/plugins/jwt/src/index.ts b/packages/plugins/jwt/src/index.ts index 8661c63a63..506fcc6416 100644 --- a/packages/plugins/jwt/src/index.ts +++ b/packages/plugins/jwt/src/index.ts @@ -1,8 +1,10 @@ import { JwksClient } from 'jwks-rsa' -import { decode, verify, JwtPayload, Algorithm } from 'jsonwebtoken' +import jsonwebtoken, { JwtPayload, Algorithm } from 'jsonwebtoken' import { Plugin } from 'graphql-yoga' import { GraphQLError } from 'graphql' +const { decode, verify } = jsonwebtoken + export interface JwtPluginOptions { /** * The endpoint to fetch keys from. @@ -97,7 +99,6 @@ export function useJwt(options: JwtPluginOptions): Plugin { } if (signingKey) { const verified = await new Promise((resolve, reject) => { - verify( token, signingKey!,