tkhamez / eve-sso-php

PHP library supporting EVE Online SSO v2.
MIT License
4 stars 1 forks source link

Fatal error: Argument 1 passed to AuthenticationProvider must be an instance of League\OAuth2\Client\Provider\GenericProvider #1

Closed cristian-dan-f closed 1 year ago

cristian-dan-f commented 1 year ago

Doing as you instructed in the README

Fatal error: Uncaught TypeError: Argument 1 passed to Eve\Sso\AuthenticationProvider::__construct() must be an instance of League\OAuth2\Client\Provider\GenericProvider, array given, called in ...

I do as instructed on README, filling with my application data:

$provider = new Eve\Sso\AuthenticationProvider(
    [
        'clientId'     => 'your-EVE-app-client-ID',
        'clientSecret' => 'your-EVE-app-secret-key',
        'redirectUri'  => 'https://your-callback.url',
        #'urlAuthorize'   => 'https://login.eveonline.com/oauth/authorize',    // SSO v1
        'urlAuthorize'    => 'https://login.eveonline.com/v2/oauth/authorize', // SSO v2
        #'urlAccessToken' => 'https://login.eveonline.com/oauth/token',    // SSO v1
        'urlAccessToken'  => 'https://login.eveonline.com/v2/oauth/token', // SSO v2
        'urlResourceOwnerDetails' => 'https://login.eveonline.com/oauth/verify', // only for SSO v1
        'urlKeySet' => 'https://login.eveonline.com/oauth/jwks', // only for SSO v2
        'urlRevoke' => 'https://login.eveonline.com/v2/oauth/revoke',
    ],
    ['esi-mail.read_mail.v1', 'esi-skills.read_skills.v1'], // add all required scopes
);

If in turn I do this:

    $provider = new League\OAuth2\Client\Provider\GenericProvider(
        [
            'clientId'                             => $eve_api_clientID,
            'clientSecret'                      => $eve_api_secretKey,
            'redirectUri'                        => 'https://your-callback.url',
            'urlAuthorize'                     => 'https://login.eveonline.com/v2/oauth/authorize', // SSO v2
            'urlAccessToken'                 => 'https://login.eveonline.com/v2/oauth/token', // SSO v2
            'urlResourceOwnerDetails' => 'https://login.eveonline.com/oauth/verify', // only for SSO v1, but must be here
            'urlKeySet'                          => 'https://login.eveonline.com/oauth/jwks', // only for SSO v2
            'urlRevoke'                         => 'https://login.eveonline.com/v2/oauth/revoke'
        ]
    );

    $authenticationProvider = new Eve\Sso\AuthenticationProvider($provider, $eve_api_scope);

it works, at least to the point where it redirects the user to EVE auth page.

tkhamez commented 1 year ago

Hi,

you must still be using version 2, the constructor params changed in version 3 (see changelog).

cristian-dan-f commented 1 year ago

No, I just downloaded today so I should be using latest version, unless something is wrong with composer config.

tkhamez commented 1 year ago

In that case you're probably using PHP 7.2 and it picked version 1.0.0 for you.

What's the output of composer outdated?