More easier auth example to understand

Hi, so after reading Authorization and Authentication documents. I am more confused.

So what I want to do ?
I want to simply have authorization for all queries/mutations etc on dgraph. I am running a local docker image for which i need to enable this.

What i understand/ Done so far
I have a public key for JWT authentication validation.
I have my app doing authentication and generation of JWT token.

My schema looks kinda like this

name: string @index(exact) .
id: uid .
hasBusiness: [uid] @reverse .

type User {
    name
    email
    hasBusiness: [Business]
}

type Business {
    name: String!
}

Now i need to add
# Dgraph.Authorization {"VerificationKey":"","Header":"","Namespace":"","Algo":"","Audience":[]}

and when I add the following:

type User @auth{
    name
    email
    hasBusiness: [Business]
}

type Business @auth {
    name: String!
}

I am unable to create the schema with following error

Error: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "line 71 column 5: Missing colon"
        debug_error_string = "{"created":"@1596803427.307484000","description":"Error received from peer ipv6:[::1]:9080","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"line 71 column 5: Missing colon","grpc_status":2}"

If someone could provide me with a working example where I have authorization enabled for all queries/mutation would be great.

Thanks for your help!

Hey @harshadbhatia

Seems like you have mixed the Dgraph and GraphQL schema there. You seem to be using a Dgraph schema and are applying GraphQL auth rules there. Auth rules can only be applied on a GraphQL schema. I’d recommend you to look at the docs at https://graphql.dgraph.io/doc/. Here is an example about Authorization, https://graphql.dgraph.io/doc/authorization/directive.