-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
Auth directive called before building the context when calling custom mutations #632
Comments
any update on this matter? |
Hey @lihaibh do you think you can provide a example that reproduce your issue, or maybe can you confirm if you can see the same behavior in the examples we have in this repo? |
Well, it turns out that the issue can't be reproduced directly with the Which means that the problem has to be with the way @lihaibh and myself specialized the example code 🤔 |
After falling on this graphql-tools issue, I've tried to replace the I'm not sure whether we should modify the |
Building the context of the module is essential for authentication because this is where we set up the authentication key, the current logged in user etc and without that, userId, user variables will remain undefined.
When i run accountsjs mutations like 'authenticate' i see that this building context function of AccountsModule and AccountsPasswordModule is called.
However it looks like that when i run my own mutations the function that builds the context never invoked... even though my module imports AccountsModule...
for example i have in my module this mutation:
I run 'authenticate' mutation to receive an access token and set the header like so:
when I run my mutation, i saw that it didnt work and when i debugged the program to understand whats going on, i saw that the auth directive is called before the context function is called so token is always "undefined" and the auth-directive fails.
BTW it would be nice to publish for all packages, the source files (in Typescript) so it would be easier to debug, because i saw some packages that miss src files like:
"@accounts/server" "@accounts/graphql-api"
Do you know what might cause this?
versions:
"@accounts/database-manager": "^0.13.0",
"@accounts/graphql-api": "^0.13.0",
"@accounts/mongo": "^0.13.0",
"@accounts/password": "^0.13.0",
"@accounts/server": "^0.13.0",
"@accounts/typeorm": "^0.13.0",
"@graphql-modules/core": "^0.6.6",
"graphql": "^14.2.0",
"graphql-errors": "^2.1.0",
"graphql-import-node": "^0.0.1",
"graphql-tools": "^4.0.4",
The text was updated successfully, but these errors were encountered: