Probably... Thanks for noticing it!
I suppose we can fix the issue by moving the `$this->storage->storeAuthorizationState($this->service(), $state);` out from the `generateAuthorizationState` and creating a dedicated method:

```php
protected function storeAuthorizationState($state)
{
    $this->storage->storeAuthorizationState($this->service(), $state);
}
```

then we can change the discussed code this way:

```php
if ($this->hasStateParameterInAuthUrl()) {
    if (!isset($parameters['state'])) {
         $parameters['state'] = $this->generateAuthorizationState();
    }
    $this->storeAuthorizationState($parameters['state']);
}
```

at this point I think that we should also rename the method `hasStateParameterInAuthUrl()` to `needsStateParameterInAuthUrl()` to make code more readable.

@cmfcmf can you make some tests and tell me if this is a viable solution?