Storefront API redirects to login

Solved
Excursionist
14 1 0

Screen Shot 2019-06-26 at 7.36.24 PM.pngHello, I am trying to send a request to Rest API ( no need to GraphQL )... my request is to get products from the API.

 

you can see what I've done in the image attached.

 

This request works only if I am authenticated as the store's admin, it doesn't work in a private browser or when you're not authenticated.

 

I have looked for this issue in Google, and I found that because the access token wasn't added, but I did and I can see it as a request's header in Chrome's DevTools

0 Likes
Excursionist
14 1 0

any idea?

0 Likes
Shopify Expert
9974 84 1491

The title of the topic is about the storefront API, but you're not using the storefront API. 

 

Now if you're using the Rest ADMIN api via the browser I'm ok with this not working.
This would expose the key and password to anyone looking at the source so is a pretty scary security issue.

What's the reason why are you doing things this way?

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Excursionist
14 1 0

All I need is to get products list as search results ( for anyone, even unauthenticated visitors )

I have tried using the API without '/admin' but doesn't work

0 Likes
Excursionist
14 1 0

any solution please?

I'm trying to get products with API and this is what I got from my search...

is ther any other API endpoint for that?

0 Likes
Highlighted

Success.

Excursionist
14 1 0

I just found out randomly that products can be retrieved by this way:

https://{store}.myshopify.com/products.json

 

Don't know why I couldn't find this solution while searching for it.

0 Likes