You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2022. It is now read-only.
Given I followed all the documentation regarding authentication on your site and added all the prerequisites for using the isAuthenticated directive, when an authenticated request (it happens ONLY when having access token in headers) involving a type or field annotated with @isAuthenticated is made, the following error comes back.
Here is the annotation:
In order to fix it, I added the check for the next() existence in the src/index.jsisAuthenticatedDirective class of your library (closer to the end of it):
export class IsAuthenticatedDirective extends SchemaDirectiveVisitor {
static getDirectiveDeclaration(directiveName, schema) {
return new GraphQLDirective({
name: "isAuthenticated",
locations: [DirectiveLocation.FIELD_DEFINITION, DirectiveLocation.OBJECT]
});
}
visitObject(obj) {
const fields = obj.getFields();
Object.keys(fields).forEach(fieldName => {
const field = fields[fieldName];
const next = field.resolve;
field.resolve = function (result, args, context, info) {
verifyAndDecodeToken({context}); // will throw error if not valid signed jwt
if (next) {
return next(result, args, context, info);
}
return result[field.name];
};
});
}
}
Please fix it in the next possible release.
FYI - using the latest version of your library in the scope of neo4j-graphql-js as of today:
The text was updated successfully, but these errors were encountered:
Hello!
Given I followed all the documentation regarding authentication on your site and added all the prerequisites for using the
isAuthenticated
directive, when an authenticated request (it happens ONLY when having access token in headers) involving a type or field annotated with@isAuthenticated
is made, the following error comes back.Here is the annotation:
In order to fix it, I added the check for the
next()
existence in thesrc/index.js
isAuthenticatedDirective
class of your library (closer to the end of it):Please fix it in the next possible release.
FYI - using the latest version of your library in the scope of
neo4j-graphql-js
as of today:The text was updated successfully, but these errors were encountered: