-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
koaJwtSecret type declaration is incorrect #46
Comments
Care to share some information that would help address this issue? |
Sorry, I was frustrated when I opened this issue so I didn't elaborate. The types for hapiJwt2Key, hapiJwt2KeyAsync, and koaJwtSecret are all the same, which is not true. It looks like they were just copied and pasted for each other. koaJwtSecret is wrong; the others might be wrong too. What it is now:
If you read the source code, the return type is completely wrong. It is more like:
I am not sure that the inputs and promise are all strings by reading just |
i have same problem. import Koa from "koa";
import Router from "koa-router";
import jwt from "koa-jwt";
import { koaJwtSecret } from "jwks-rsa";
import { ApolloServer } from "apollo-server-koa";
import graphqlSchema from "./schema";
const graphqlServer = new ApolloServer({
schema: graphqlSchema,
});
const app = new Koa();
const router = new Router();
app.use(
jwt({
secret: koaJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 2,
jwksUri: "test/jwks.json",
}),
audience: "http:https://myapi/protected",
issuer: "http:https://issuer",
algorithms: ["RS256"],
}),
);
|
I'm having this problem too. This should match the signature of export type SecretLoader = (header: any, payload: any) => Promise<string | string[] | Buffer | Buffer[]>; You can shut the compiler up for the time being: app.use(
jwt({
secret: koaJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 2,
jwksUri: "test/jwks.json",
}) as jwt.SecretLoader,
audience: "http:https://myapi/protected",
issuer: "http:https://issuer",
algorithms: ["RS256"],
}),
); |
This is causing errors in my typeScript code.
The text was updated successfully, but these errors were encountered: