Can you call Shopify REST Admin API directly from template Javascript? 🔒

### Explanation While it is technically possible to call the Shopify REST Admin API from template JavaScript by including admin credentials or access tokens, this is a significant security risk that should never be done. Key points: - JavaScript in theme templates is client-side and visible to all users - Including admin credentials in JavaScript would expose them to: - Anyone who views the page source - Browser developer tools - Secure alternatives for client-side operations: - Use the Storefront API with public access tokens - Implement server-side endpoints with proper authentication Reference: [Shopify Liquid Documentation](https://shopify.dev/docs/themes/liquid/reference)

Answer Options:

  • Yes, using the filter
  • Yes, but only in development mode
  • No, Admin API requires admin authentication which isn't available in Liquid
  • Yes, but it's highly insecure because it requires a secret token in the template
Shopify Free Test
← PreviousQuestion 1 of 1Finish →
00
← PreviousFinish →
Copyright ©Michael Bollin. Found some mistake?[email protected]