Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Storefront API redirects to login

Solved

Storefront API redirects to login

akad
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

Accepted Solution (1)
akad
Excursionist
14 1 0

This is an accepted solution.

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.

View solution in original post

Replies 5 (5)

akad
Excursionist
14 1 0

any idea?

Jason
Shopify Partner
11206 226 2315

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?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
akad
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

akad
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?

akad
Excursionist
14 1 0

This is an accepted solution.

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.