hkonnet / laravel-ebay

This package for laravel framework to access Ebay.
MIT License
40 stars 42 forks source link

Missing required configuration options: authorization #7

Closed edemir206 closed 4 years ago

edemir206 commented 6 years ago

Hi,

I'm trying for days to use the ebay getItem in the Browse Rest api without success, I already know about the oauth access token authorization for users. My app will only uses ebay public information, in this case do I still need every user log in to see this kind of info ?

I know that with Finding api you don't need all that stuff, you just pass your app id and secret and everything works, in Rest api can it be solved this way with an application token or something like that ?

Please if someone help me I will be very thankful.

Btw that's the code i've used:

// Create the service object.
        $ebay_service = new EbayServices();
        $service = $ebay_service->createBrowse();
hkonnet commented 6 years ago

Hi,

Can you post what error message you get when you try to fetch items from Ebay?

edemir206 commented 6 years ago

Trying to fetch items from ebay from the old FindingApi works ok, I need to get the new rest api to work. The problem is I don't know if I need and oauth access token for every request and if this tokens need to be renewed from time to time.

Man this api is so hard to understand.

smartsyncio commented 5 years ago

this error is related to using oAuth and this doesn't support it properly in its current form

Modifying the service connection like this made it work for me

IN YOUR CONTROLLER

    $service = new Services\TradingService([
        'credentials'   => config('ebay.'.config('ebay.mode').'.credentials'),
        'sandbox'       => $sandbox,
        'siteId'        => 1,
        'authorization' => $ebayAuth->auth_token, <-// this comes from ebay after the whole get token thing
    ]);

IN \VENDOR\HKONNET\LARAVEL-EBAY\SRC\EBAY.php

    $sandbox = config('ebay.mode') == 'sandbox'?true:false;
    $config = [
        'credentials' => config('ebay.'.config('ebay.mode').'.credentials'),
        'siteId'     => config('ebay.siteId'),
        'sandbox' => $sandbox,
        'ruName' => config('ebay.'.config('ebay.mode').'.ruName'), <-// doesnt work without ruName which is not added by default
    ];

IN EBAY CONFIG

    'credentials' => [
        'devId'         => env('EBAY_SANDBOX_DEV_ID'),
        'appId'         => env('EBAY_SANDBOX_APP_ID'),
        'certId'        => env('EBAY_SANDBOX_CERT_ID'),
    ],
    'ruName'            => env('EBAY_SANDBOX_RUNAME'), <-// store your ruName in your config
price2b commented 5 years ago

Hi @smartsyncio !, I made the changes you described. For App Token Im using the following code with success:

        $request->RequesterCredentials = new Types\CustomSecurityHeaderType();
        $authToken = Ebay::getAuthToken();
        $request->RequesterCredentials->eBayAuthToken = $authToken;

Do we have to change anything in the previous code to request a USER token (redirect to ebay site, generate a token and refresh,etc) or using runame in credentials is enough?

Im trying the last approach but it generates an apptoken, not user. thanks in advance.