I want to register a new user in Drupal8 backend. Installed graphql in drupal8 so its working as graphql server. Installed apollo in angular5 and successfully fetched nodes and articles list. Now I want to register a user in drupal8 using graphql query from angular side.
const headers = new HttpHeaders();
headers.append("Access-Control-Allow-Origin", "*");
headers.append("Access-Control-Allow-Headers", "x-requested-with");
const submitClient = gql`mutation ($input: UserUserCreateInput!) {
createUserUser(input: $input) {
violations {
path
message
}
errors
entity {
entityId
entityBundle
entityLabel
}
}
}
`;
this.apollo.mutate({
mutation: submitClient,
variables: {
"input": {
"name": "New Client",
"mail": "newClient@gmail.com",
"status": "1"
}
}
}).subscribe(r => console.log(r), e => console.log(e), () => console.log('done'));
This is my piece of code.
Getting a response
data:
createUserUser:
entity: null
errors: Array(1)
0: "You do not have the necessary permissions to create entities of this type."
length: 1
proto: Array(0)
violations: []
__typename: "EntityCrudOutput"
proto: Object
proto: Object
This must be because of some authentication or permission related. Please help me to figure this out. Thanks in advance.