- Print
- DarkLight
How do I authenticate using GraphiQL?
Article summary
Did you find this summary helpful?
Thank you for your feedback
How do I authenticate when using the web interface GraphiQL?
Request an authentication token with cURl and use the GraphiQL interface to send requests.
Installing ModHeader
When using GraphiQL you have to include an authentication token in the header. You can use the extension ModHeader for this. You can find the links to the stores for the different browsers here: ModHeader
Request token via cURL
Add Client ID and Client Secret here and request a token:
curl --request POST \
--url https://promaterial.eu.auth0.com/oauth/token \
--header 'content-type: application/json' \
--data '{
"client_id":"<your client ID>",
"client_secret":"<your client secret>",
"audience": "http://mdg.promaterial.com/api",
"grant_type": "client_credentials"
}'
You will receive the following response:
{
"access_token":"<access token, valid for 24 hours>",
"scope": "read:products read:order read:shoppingCart",
"expires_in": 86400,
"token_type": "bearer"
}
Using GraphiQL
Access the GraphiQL interface from this link:
http://<your-dg-code>.dg.prod.promaterial.com/api
Open the "ModHeader" extension and add the "Authorization" header. The value is "Bearer " and the "access_token" from the response of the previous request.
Was this article helpful?