Rest Api - console error ([Deprecation] Subresource requests whose URLs contain embedded credentials

Solved
Highlighted
Tourist
6 0 0

 

Hi there,

I am trying to use the rest api to simply get the products of a collection, I want to display the products on a non-shopify website using the image, title, price, product link

so users can click and go to the product page of the store. 

 

I have created an app in the backend of shopify, and am using the query as below(with proper credentials):

 

https://{apikey}:{password}@{hostname}/admin/api/{version}/{collectionid}/products.json

 

I'm making a js call like below:

 

$.ajax({
    url: 'https://{apikey}:{password}@{hostname}/admin/api/{version}/{collectionid}/products.json',
    jsonp: 'callback',
    dataType: 'jsonp',
    success: function(data) { 
        console.log(data);
    }
});

 

The console error I am getting is: 

 

[Deprecation] Subresource requests whose URLs contain embedded credentials (e.g. `https://user:pass@host/`) are blocked. See https://www.chromestatus.com/feature/5669008342777856 for more details.

 

I'm wondering what I am doing wrong here, and also if this is the correct api to use for my circumstance, thank you for the help!

 

- Jordan

0 Likes
Highlighted
Shopify Staff
Shopify Staff
493 98 88

This is an accepted solution.

Hi @jordan-warner-8 

 

As discussed in your other open thread, you should use the Storefront API. Alternatively, Cart Permalinks or the Buy Button

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes