The community member is looking for a way to authenticate GraphQL queries in a headless WordPress setup, specifically for a preview page that requires authorization. They have found information about using a JWT plugin to get an authentication token, but it's not recommended to extend the expiration delay beyond the default 300 seconds. The community member suggests using WordPress session credentials, which is possible with the WPGraphQL CORS plugin, but they need to add the "credentials: include" field to their GraphQL query, which doesn't seem to exist in the GraphQL panel in WebStudio. The community member has shared a script they used to achieve this, but they would prefer a no-code way to add the "credentials: include" attribute to the GraphQL configuration.
Hey I was looking on resources about authentifying query in graphql? (in a headless wordpress, I want to create a preview page, which needs authorization, but there is so many others use cases !).
I've found many informations on graphql doc. with JTW plugin, I can get auth token to authentify graphql query. But it is not recommended to extend expiration delay with defaut 300 seconds.
So I have to get user auth token when my query is sent. The best way seems to use wordpress session credentials, which is possible thanks to WPGraphQL CORS plugin.
Now I need to add "credentials : include" to my graphql query, but this field doesn't exist in graphql panel in webstudio.
Is there an other way to achieve this ?
I share you the script I used to achieve this but I would prefer a no-code way !!
Is it possible to add the "credentials: include" attribute in the graphql configuration?