Can I use the JavaScript Buy SDK or query/mutate with GraphQL from within the theme liquid files?

The {“errors”:[{“message”:“”,“extensions”:{“code”:“UNAUTHORIZED”}}]} error occurred. I added my app’s API access token from the Shopify Partner account, so why did this happen? I am calling the query in the Theme Extension app’s Liquid file, and then the error appeared.