eveseat / eseye

👾 A Standalone, Dynamic ESI (EVE Swagger Interface) Client Library written in PHP
GNU General Public License v2.0
50 stars 30 forks source link

Error on scope count? #60

Closed azak1r closed 4 years ago

azak1r commented 4 years ago

when running the follow:

$char = auth()->user();

        $authentication = new EsiAuthentication([
            'client_id'     => env('EVEONLINE_KEY'),
            'secret'        => env('EVEONLINE_SECRET'),
            'access_token'  => $char->eve_token,
            'refresh_token' => $char->refreshToken,
            'scopes'        => 'esi-assets.read_assets.v1',
        ]);

        $esi = new Eseye($authentication);

        $character_assets = $esi->invoke('get','/characters/{character_id}/assets/', [
            'character_id' => $char->id,
        ]);

it throws the following error

ErrorException
count(): Parameter must be an array or an object that implements Countable

referencing this section of \eveseat\eseye\src\Fetchers\GuzzleFetcher.php

// If there are no scopes that we know of, update them.

        // There will always be at least 1 as we add the internal

        // 'public' scope.

        if (count($this->getAuthentication()->scopes) <= 0)

            $this->setAuthenticationScopes();

        return $this->getAuthentication()->scopes;

    }

What should it try to do to fix it?

leonjza commented 4 years ago

scopes should be an array. So, 'scopes' => ['esi-assets.read_assets.v1'],

leonjza commented 4 years ago

Ref: https://github.com/eveseat/eseye/blob/bac1787861b1180c74b9c5cda881ca0990f4e293/src/Containers/EsiAuthentication.php#L46.

azak1r commented 4 years ago

yeah i overlooked the array thing. i apologize