Password field in GraphQL as custom dgraph type

The Dgraph password type is not query-able as a field. This is settable using the @secret directive on the type itself, where you can set a field and pred for the type. For example, if you set the Dgraph schema as:

password: password .

Then, in your GraphQL schema, you can use this predicate like so:

type User @secret(field: "userPassword", pred: "password") {
  ...
}

See the docs for more info: https://dgraph.io/docs/graphql/schema/types/#password-type

1 Like