jumbojett / OpenID-Connect-PHP

Minimalist OpenID Connect client
https://github.com/jumbojett/OpenID-Connect-PHP
Apache License 2.0
613 stars 367 forks source link

Undefined index openid_connect_state in Lumen 5.6 #175

Open DurgadeviS opened 5 years ago

DurgadeviS commented 5 years ago

Hi,

I'm using lumen 5.6, i have enable the session also by using

'composer require illuminate/session'.

After getting my "REDIRECT URI", i got the error in Undefined index: openid_connect_state

One issue Unable to determine state i got this error also.

Kindly clear my issue, past few days before it's working fine. But nowadays i got the error.

Kukulkano commented 4 years ago

I have the same, but not always. How did you solve this? I get the error while calling

$name = $oidc->requestUserInfo('name');

My error is `Jumbojett\OpenIDConnectClientException: Unable to determine state in /home/volker/git/ppp/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php:278 Stack trace:

0 /home/volker/git/ppp/lib/p_login.php(98): Jumbojett\OpenIDConnectClient->authenticate()

1 /home/volker/git/ppp/lib/p_login.php(47): _ConnectOpenID(Object(Jumbojett\OpenIDConnectClient))

2 /home/volker/git/ppp/www/index.php(64): Output()

3 {main}`

DorelBesliu commented 4 years ago

The same issue is on my side. Please let me know if you have an answer ...

michug commented 3 years ago

I have the same issue but before before finishing the authenticate workflow.

I have a backend in Laravel 5.6 and a vue-cli frontend

When I hit the laravel endpoint directly (by inputing the url in the browser) everything works fine.

But when the enpoint is triggered by an axios request, after the user logs In I get the error. Before it can request an access_token

Kukulkano commented 3 years ago

Any news on this? With 35.000 logins I have about 1060 log entries with this Notice. So it happens around every 35th login.

I have no clue about any possible reason and I'm not deep into OpenID :-(

Maybe I enhance function getSessionKey() in OpenIDConnectClient.php like this?

protected function getSessionKey($key) {
    $this->startSession();

    return isset($_SESSION[$key])?$_SESSION[$key]:"";
}

This would prevent these notifiers, but I don't like this. It is simply preventing the PHP Notice. Maybe there are better solutions that handle the cause?

I personally think it happens if people use outdated links or set a bookmark containing a code= or state= parameter in the URL. This is always followed by a catchable error like Jumbojett\OpenIDConnectClientException: Unable to determine state.