Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidArgumentException #61

Open
userbig opened this issue May 6, 2020 · 20 comments
Open

InvalidArgumentException #61

userbig opened this issue May 6, 2020 · 20 comments
Labels

Comments

@userbig
Copy link

userbig commented May 6, 2020

I just have another fresh installment of eseye on my laravel app and I get some error

InvalidArgumentException
Unsupported input

Jose\Component\Signature\Serializer\CompactSerializer::unserialize vendor/web-token/jwt-signature/Serializer/CompactSerializer.php :72

https://flareapp.io/share/o7AeeB7p#F50

lib version 2.2.1

upd: after downgrading to 2.0.0 everything is fine.

@warlof
Copy link
Member

warlof commented May 6, 2020

Hi,

This is caused by the missing access token in your authentication container.
If you add a valid SSO2 token in it, it should pass.

@userbig
Copy link
Author

userbig commented May 7, 2020

If such so you probably need to fix guidelines
https://github.com/eveseat/eseye/wiki/Eseye-Simple-Tutorial

@warlof
Copy link
Member

warlof commented May 9, 2020

That would assume the old case is non longer valid.
I'm not sure of the state yet.

However, can you confirm it is working properly if you provide the token ?

@Renrut5
Copy link

Renrut5 commented May 17, 2020

I'm also having this issue. I can confirm I passed the access code into the authorization container and it still failed.

Downgrading to version 2.0.0 and deleting the old file cache also fixed the problem for me (and using the same code).

@warlof
Copy link
Member

warlof commented May 17, 2020

do you have a sample of your used code ?

@Renrut5
Copy link

Renrut5 commented May 17, 2020

the $character value is where I pull the information from the database and push it to the container.

$character = EveIndustry::GetCharacter();

$authentication = new EsiAuthentication(array(
    'client_id'     => EVE_CLIENT_ID,
    'secret'        => EVE_SECRET_KEY,
    'access_token' => $character->accessToken,
    'refresh_token' => $character->refreshToken,
    'token_expires' => date('Y-m-d H:i:s', $character->tokenEOL)
));

$esi->setAuthentication($authentication);

$employment = $esi->invoke('get', '/characters/{character_id}/blueprints/', [
    'character_id' => $character->CharacterID
]);

@warlof
Copy link
Member

warlof commented May 17, 2020

Are you using SSO v2 token ? or is it SSO v1 format ?
SSO v1 token will not work with 2.2.0 or greater since eseye is using JWT format.

@Renrut5
Copy link

Renrut5 commented May 17, 2020

Pretty sure I'm using SSO v2, although I'm using a different library for authenticating the characters and the scopes so I could be wrong.

I couldn't find a way to use Eseye to get the initial access token and refresh token from the authentication code. Am I missing something somewhere?

@warlof
Copy link
Member

warlof commented May 17, 2020

You can use this portal to decode a token https://jwt.io/
If it's a v2, it must be built in three part and contain scope list

@Renrut5
Copy link

Renrut5 commented May 17, 2020

It seems my tokens are not in JWT format, which would explain a big part of the issue. Not sure where to go from here.

@warlof
Copy link
Member

warlof commented May 18, 2020

That's from CCP docs :
https://github.com/esi/esi-docs/blob/master/docs/sso/web_based_sso_flow.md
https://github.com/esi/esi-docs/blob/master/docs/sso/validating_eve_jwt.md

Here is the way we've implemented it in SeAT :
https://github.com/eveseat/services/tree/4.0.x/src/Socialite/EveOnline

Also, either you make the switch from SSO v2.0 or if you stick to SSO v1.0, you have to target eseye 2.0.*

@Renrut5
Copy link

Renrut5 commented May 18, 2020

Thanks for the help, when tried targeting the SSO v2 I get different a grant type not supported error, but I'll try the links you sent. If it doesn't work I will either post on the Eve forums or open a different issue so this one doesn't get any more cluttered.

@KomAuras
Copy link

KomAuras commented Jun 16, 2020

Thanks for the help, when tried targeting the SSO v2 I get different a grant type not supported error, but I'll try the links you sent. If it doesn't work I will either post on the Eve forums or open a different issue so this one doesn't get any more cluttered.

use https://github.com/nullx27-org/eveonline-socialite
and replace in EveOnlineSocialiteProvider.php
https://login.eveonline.com/oauth/authorize
to
https://login.eveonline.com/v2/oauth/authorize
&
https://login.eveonline.com/oauth/token
to
https://login.eveonline.com/v2/oauth/token
i try. all ok!

@awingender
Copy link

I am having the same issue as OP originally stated, but had trouble following the final solution to get it working again.

InvalidArgumentException
Unsupported input

Jose\Component\Signature\Serializer\CompactSerializer::unserialize vendor/web-token/jwt-signature/Serializer/CompactSerializer.php :72

@warlof
Copy link
Member

warlof commented Jun 17, 2020

@awingender are you providing an access token ?
do you have any code sample to get a bit of context ?

@awingender
Copy link

awingender commented Jun 17, 2020

I am new to Eseye and am still trying to get the example to work.

Edit: I used Token Generator to make the access token.

Edit 2: I downgraded to 2.0.0 like others, and Eseye works now. This time, I did not put an access token anywhere. Just the refresh key. I am very much interested in knowing what I was doing wrong, and am willing to help.

<?php

// Eseye - Simple Tutorial

include 'vendor/autoload.php';

$client_id = 'ea2e784a44dxxxxxxxxxxb1dd9615451';
$secret_key = 'yNoSs8C2Mwc9vxxxxxxxxxxBNtqxeY7xxxxxPdjW';
$refresh_token = 'sLcwsxxxxxHDDizQa16H7STgGmUBQS5cE7g4hPzKdXDKZJ-BjWWolfyPxY9v9bCyf8lRSiSe_FV0UwIPeZ11y6RoyYfuCOVjEVk9BGEtEcFsy5cZidluXXh9xxxxx6M4Zt-5ApQGu0xxxxxbTpH8dZ5njufnrlmzbh3xxxxx1NPcsELT_gexJSCuBdoDydj32yNXkPH_nRHXYa0Z2YpSeqiCB5h4ALoxxKPDVOd1KJwsGI8NPFGfZ0g-ITGGpSRiUgy4H-XB8JIAaO_GbTjqLWB0b_pzxmM8d0mxxxxxWcLruGqHnQ_p2pZfxChu9au41_z-f1ClL9pLKNYXw2Vv2hrZ6JQfmO1NzMR9THIv0mJ2dgy1XdCoTgZmiEVh9DgC_wDwpeOnrob-eo09V0wBDQ';

$authentication = new \Seat\Eseye\Containers\EsiAuthentication([
    'client_id'     => $client_id,
    'secret'        => $secret_key,
    'refresh_token' => $refresh_token,
]);

$esi = new \Seat\Eseye\Eseye($authentication);

$character_info = $esi->invoke('get', '/characters/{character_id}/', [
    'character_id' => 1477911111,
]);

echo $character_info->name;

Here is where I put my access token... inside EsiAuthentication.php

namespace Seat\Eseye\Containers;

use Seat\Eseye\Traits\ConstructsContainers;
use Seat\Eseye\Traits\ValidatesContainers;

/**
 * Class EsiAuthentication.
 * @package Seat\Eseye\Containers
 */
class EsiAuthentication extends AbstractArrayAccess
{

    use ConstructsContainers, ValidatesContainers;

    /**
     * @var array
     */
    protected $data = [
        'client_id'     => null,
        'secret'        => null,
        'access_token'  => '1|CfDJ8Hj9X4L/huFJpslTkv3swZP7cpJlIx8+Cyi6FCu8sl7/0lJ5GifCbEm+yuKbIt7yEMkwUZZImojFVeI+Qaw7/LZVqCxxxxx9JILt1uI79ih4c+DGzRS1oxLvi+Ox+2ESIEzpLQxxxxxMUPthjnDjO7nmdxxxxxTZbGOaqqVDGbLU',
        'refresh_token' => null,
        'token_expires' => '1970-01-01 00:00:00',
        'scopes'        => [],
    ];

    public function setRefreshToken(string $refreshToken): self
    {

        $this->data['refresh_token'] = $refreshToken;

        return $this;
    }
}

Here is my output:
image

@warlof
Copy link
Member

warlof commented Jun 18, 2020

@awingender thank you to pointing the toolbox

new version is shipped with a toolbox compatible with JWT tokens / OAuth v2 endpoints

@chatelao
Copy link

Has somebody of you a working fork with the "2.0" downgrade applied?

@mgibula
Copy link

mgibula commented Aug 13, 2020

I believe there is a bug in GuzzleFetcher.php in setAuthenticationScopes() - it takes access token from authentication container, when it should just call getToken(). Currently, access_token needs to be explicitly set and it also needs to be valid, otherwise JWT validation goes boom, which kinna defeats the purpose of token autorefreshment.

Changing

$jws_token = $this->verifyToken($this->authentication->access_token);

to

$jws_token = $this->verifyToken($this->getToken());

seems to be working for me (at least for now:-) ).

@cristian-dan-f
Copy link

This is still an issue 2 years later.

Following the instructions, it says nothing about having to provide the access_token, so I get exact same error as OP.

Manuals and Wiki should be update to clarify exactly what is needed.

Now, after adding the extra/missing data I get an error because the token has expired, so for some reason is not even trying to refresh the access_token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants