score:1

Accepted answer

try removing the mode: 'no-cors' and 'withcredentials: true' and handle cors from the backend php magento2 - please check this link on how to do it

fetch("http://m2.example.com/rest/v1/products?searchcriteria[page_size]=20",{
        method: 'get',           
        credentials: 'include',
    headers: {
        'authorization': 'bearer 3nsi1y7pcun1atvhs87dxmokymquofii', 
        'content-type': 'application/json'
    }

after that it should work.


Related Query

More Query from same tag