Authorization issue when running dgraph locally vs Slash


Report a Dgraph Bug

What version of Dgraph are you using?

20.11.0 and Slash

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

docker-compose so the specs are virtual

Steps to reproduce the issue (command/config used to run Dgraph).

I am trying to use JWT for auth but it doesn’t work when running dgraph myself - it works in Slash.

Here’s a simple Todo

type Todo @withSubscription @auth(
    query:  { rule: "{ $email: { eq: \"fff@fff.com\" } }"}
    add:    { rule: "{ $email: { eq: \"fff@fff.com\" } }"}
    update: { rule: "{ $email: { eq: \"fff@fff.com\" } }"}
    delete: { rule: "{ $email: { eq: \"fff@fff.com\" } }"}
) {
    id: ID!
    value: String!
    completed: Boolean! @search
}
# Dgraph.Authorization {"VerificationKey":"-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----","Header":"X-Auth-Token","Namespace":"jhk324jk","Algo":"RS256"}

Expected behaviour and actual result.

If I try to query or add data without the @auth, it works, when I add it back it doesnt. With @auth it only works on slash, but as soon as i change the url back to my docker onein apollo-client, it stops working again, unless if I remove @auth.