简体   繁体   中英

Magento 2 rest API with React native

I was tried below the code I am using OAuth 1.0 I am having Consumer Key,Consumer Secret, Access Token, Token Secret I'm getting response message: "A consumer having the specified key does not exist" anyone guides me for the right track

componentWillMount() {
    this.getProductDetail();
}

getProductDetail() {
    debugger
    let url = `http://13.233.175.20/index.php/rest/V1/products?fields=items&searchCriteria[pageSize]=1000`;     
    fetch(url, {
        method: 'GET',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            "Authorization": 'OAuth oauth_consumer_key="m7eumn0mabhts4mlmggecrpikqg07u6l",
               oauth_token="4x1kjjkb0klj9mo4t88nv4xmulybszfi",
               oauth_signature_method="HMAC SHA1",oauth_timestamp="1550568244",
               oauth_nonce="JoNsTPLKHxA",oauth_version="1.0",
               oauth_signature="0b8SA2r4fHtV05G8yy%2BhYMqAH2M%3D"'
        },
    }).then((response) => response.json())
    .then((response) => {
        debugger;
        this.setState({
            productDetail: JSON.parse(response)
        });

    }).catch(function (error) {
            //Log an error here
        });
}

I had the similar error, I was using expired keys. Please try by Re-authorizing keys or creating new keys as:

From Magento admin dashboard

System->Extensions->Integrations->Add New Integration/Reauthorize

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM