Is it secure to access data in client?

I’m totally new to graphQL. Most of my experience is in Laravel backend full stack. I’m learning and creating a new project using front-end framework svelte and have decided all the Laravel boilerplate setup, server setup, etc is something i’d like to avoid. Hence 8base.

My question is can i get/post/put my 8base data directly via client? Here is an example of a test component i’m using. Is the token, query and endpoint exposed? I’m sorry, i’m having a hard time wrapping my head around this concept. Thank you in advance.

```  import { request, GraphQLClient } from "graphql-request";

```` const token = "808e4b7e-mytoken";
```` const endPoint = "https://api.8base.com/myendpoint";

```` const GET_PLAYERS = `
  ````     query {
   ````        playersList {
   ````            count
   ````            items {
   ````            first_name
  ````             }
  ````         }
 ````      }
  ````     `;

```` //create a new instance of GraphQLClient in order to add an authorization header
```` const client = new GraphQLClient(endPoint, {
````   headers: {
````     authorization: token,
````    },
````  });

 ```` const exec = async () => {
````   const resp = await client.request(GET_PLAYERS);
````    console.log(resp);
````    return resp;
````  };

```` exec();

Hi @ralanyo, if you wanna use API Token (which you can create in our UI) - it’s not secure. Endpoint, queries, and mutations are public you can use it anywhere. Tell me more about what you wanna do and I can try to help you.

1 Like