-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Is it still possible to use Apollo context option for authentication like DataLoader is still avalable through context IIRC seeing the code.
If so how do I do it as the following does not seem to be being called at all.
app.use("/graphql", bodyParser.json(), vesper(schema, {
setupContainer: async (container, action) => {
console.log("setupContainer()");
const request = action.request;
const token:string = request.headers["token"] as string || "";
if (token !== "") {
const entityManager = getManager();
const payload = jwt.verify(token, "secret");
const currentUser = await entityManager.findOneOrFail(User, { id: payload["id"] });
container.set(User, currentUser);
console.log("this.currentUser = ", currentUser);
}
}
}));
as the above does not seem to be doing anything a
Metadata
Metadata
Assignees
Labels
No labels