Open madebyfabian opened 1 year ago
The origins option does not work on servers:
{
"data": {
"sendEmail": {
"to": "example@example.com",
"sent": false,
"replyTo": "",
"origin": "",
"message": "Origin not allowed, set origin in settings",
"clientMutationId": null
}
},
"extensions": {
"debug": [
{
"type": "DEBUG_LOGS_INACTIVE",
"message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled."
}
]
}
}
So this is not an option.
headers: { 'Content-Type': 'application/json', Origin: 'http://localhost:5173', }
that worked for me
I am using this plugin to send a contact form email., this will be handled by a server. My WPGraphQL server does not require authentication for queries, only for mutations. (e.g. an unauthenticated user of the API can query information, but is not able to mutate any data). This is archived by unchecking this WPGraphQL setting:
I see that this plugin also allows unauthenticated request to make mutations (sending emails).
I would like to have an option in the settings where I can limit the ability to send emails to authenticated requests only.