patrickbussmann / oauth2-apple

Sign in with Apple Provider for the OAuth 2.0 Client
MIT License
95 stars 64 forks source link

Serialization of 'Closure' is not allowed #28

Closed bettinz closed 3 years ago

bettinz commented 3 years ago

Hello, as I wrote here: https://github.com/knpuniversity/oauth2-client-bundle/issues/326

using the apple login with this bundle I have this server error:

Serialization of 'Closure' is not allowed The error is triggered from

/vendor/symfony/security-guard/Authenticator/GuardBridgeAuthenticator.php in serialize at line 78

        throw new \UnexpectedValueException(sprintf('The return value of "%1$s::getCredentials()" must not be null. Return false from "%1$s::supports()" instead.', get_debug_type($this->guard)));
        }
        // get the user from the GuardAuthenticator
        if (class_exists(UserBadge::class)) {
            $user = new UserBadge('guard_authenticator_'.md5(serialize($credentials)), function () use ($credentials) { return $this->getUser($credentials); });
        } else {
            // BC with symfony/security-http:5.1
            $user = $this->getUser($credentials);
        }

The line is:

$user = new UserBadge('guard_authenticator_'.md5(serialize($credentials)), function () use ($credentials) { return $this->getUser($credentials); });

Can you help me to understand what is wrong? I'm using sf 5.3 with new authenticator system

enable_authenticator_manager: true

Thanks