fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

Uncaught Exception: Unable to load private key #79

Open Tekrajs opened 5 years ago

Tekrajs commented 5 years ago

I tried your sdk for wall-mart integration but it failed at the very beginning. I did the dollowing thing:

        require_once 'vendor/autoload.php';

        use Walmart\Feed;

        $client = new Feed([
            'consumerId' => 'MYCONSUMERKEY',
            'privateKey' => 'MYPRIVATEKEY'
        ]);

        $feed = $client->get([
            'feedId' => 'EAA473B65DFF4DA6A80DA4C8586E4BA9@AQMBAQA', // required
            'includeDetails' => 'true', // optional, default false
            'limit' => 50, // optional, default 50
            'offset' => 0, // optional, default 0
        ]);

But vendor/fillup/walmart-auth-signature-php/src/Signature.php:112 here error is thrown. I checked there

    if($rsa->loadKey($decodedPrivateKey,RSA::PRIVATE_FORMAT_PKCS8)){}

was checked. Which then returned false. So I went to $rsa->loadKey where I saw

    if ($key instanceof RSA) {}
    if ($type === false) {}else {
        $components = $this->_parseKey($key, $type);
    }

The code enters into else statement where _parseKey returns false. What is actually happening here ? Am I missing any php modules or is this the fault of SDK ?

Please help me out on this. Thanks

gaurav2262 commented 5 years ago

@Tekrajs I am also using this API and I need little help for Where to get this privateKey? I have client id and client secret but I don't know from where to get privateKey? Also, there is one config parameter is required for the order API call is wmConsumerChannelType I don't know what it is and also from where to get this?

yanggg1133 commented 2 years ago
    $client = new Order([
        'consumerId' => '',
        'privateKey' => '',
        'wmConsumerChannelType' => 'WM_CONSUMER.CHANNEL.TYPE',
    ]);

also this error /;