# How to make secure Graphql query with Authentication token

**URL:** <https://forum.oxid-esales.com/t/how-to-make-secure-graphql-query-with-authentication-token/99139>\
**Category:** English forums\
**Created:** [August 29, 2023, 6:04am UTC](https://forum.oxid-esales.com/t/how-to-make-secure-graphql-query-with-authentication-token/99139 "2023-08-29T06:04:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev\_galitein](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/dev_galitein/32/3699_2.png) [@dev\_galitein](https://forum.oxid-esales.com/u/dev_galitein)\
**Post date:** [August 29, 2023, 6:04am UTC](https://forum.oxid-esales.com/t/how-to-make-secure-graphql-query-with-authentication-token/99139/1 "2023-08-29T06:04:21Z")

</div>

Currently, I am implementing GraphQl with oxid and I am also getting data based on the query  
but all the query is working without any authentication so need to add security like there is must required valid token. otherwise, give an Unauthenticated error

My current query

```auto
  query GetProducts {
  products {
    id
    title
    mpn
    ean
    shortDescription
    varMinPrice  
      }
}

```

and I am getting responses like below

```auto
{
  "data": {
    "products": [
      {
        "id": "062b2914d57389263ae7bdd773c70f4a",
        "title": "Hailys",
        "mpn": "99",
        "ean": "100",
        "shortDescription": "Mens Oversized T-Shirt with Stylish Chest Pocket",
        "varMinPrice": 35.99
      },
      {
        "id": "066e3ce119c43c81cc0e46d4f1681eed",
        "title": "Destiny",
        "mpn": "",
        "ean": "",
        "shortDescription": "Hardcase hand luggage suitcase",
        "varMinPrice": 70.95
      },

```

This works completely fine  
but now here I want to make sure that each query needs to pass a valid token and then the response we get.

so for that what changes do we need to make? and what place do I need to implement those changes?

Please Help me for pointing this thing  
Thank you !!

---

<div class="post-metadata">

**Author:** ![naledre](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/n/a5b964/32.png) [@naledre](https://forum.oxid-esales.com/u/naledre)\
**Post date:** [August 30, 2023, 4:35pm UTC](https://forum.oxid-esales.com/t/how-to-make-secure-graphql-query-with-authentication-token/99139/2 "2023-08-30T16:35:19Z")

</div>

This is public shop data, why would it need authentication? Otherwise, your entire shop also needs authentication.

This can be done via .htaccess, for example.

---

<div class="post-metadata">

**Author:** ![system](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/system/32/4245_2.png) [@system](https://forum.oxid-esales.com/u/system)\
**Post date:** [August 29, 2024, 4:36pm UTC](https://forum.oxid-esales.com/t/how-to-make-secure-graphql-query-with-authentication-token/99139/3 "2024-08-29T16:36:15Z")

</div>

Closed on August 29, 2024, 4:36pm UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
