I have spent the day trying to get Authorization to work in my local Dgraph instance, but have been unable to block access to the server in the first place.
I have a user node with a rule that should prevent queries from going through
type User @auth(
query: { rule: "{ $NeverHere: { eq: \"anything\" } }" }
) {
and I have added the Dgraph.Authorization note at the bottom of my schema:
Based on the docs and the tutorials, my code described above should be preventing me from querying users, but that is not the case, I can query them without trouble.
What else do I need to do for authorization to “take effect”?
Hey, I am still working through this, but the issue seems to be that the updated schema was not applying even though I ran the command to apply it. The yarn command I use is the following. I would have expected an error, but it just says “Done”
"schema": "curl -X POST localhost:8080/admin/schema --data-binary '@dgraph/schema.graphql'",
Apparently I had a bug in the schema that I wasn’t noticing because I didn’t get any indication that publishing had failed
Did you try to increase the verbosity level and set the graphql debug mode of the alpha ?
It could help to have hints when you push your schema and query the data.