Kdyby / Facebook

[DEPRECATED] Use https://github.com/thephpleague/oauth2-facebook instead
Other
42 stars 36 forks source link

Using without session #44

Open bohdankolecek opened 9 years ago

bohdankolecek commented 9 years ago

We need to call GET /me for every given access token in ReactPHP CLI script. Kdyby\Facebook\SessionStorage class depends on Nette\Http\Session which calls session_start(), which causes the following error in the CLI script:

Cannot send session cache limiter - headers already sent

Is it possible to use the Kdyby/Facebook without opening the session?

Traceback follows:

#0 /var/www/project/vendor/nette/utils/src/Utils/Callback.php(87): Nette\Http\Session->Nette\Http\{closure}('Cannot send ses...', 2)
#1 [internal function]: Nette\Utils\Callback::Nette\Utils\{closure}(2, 'session_start()...', '/var/www/projec...', 96, Array)
#2 /var/www/project/vendor/nette/utils/src/Utils/Callback.php(96): session_start()
#3 /var/www/project/vendor/nette/http/src/Http/Session.php(99): Nette\Utils\Callback::invokeSafe('session_start', Array, Object(Closure))
#4 /var/www/project/vendor/nette/http/src/Http/SessionSection.php(54): Nette\Http\Session->start()
#5 /var/www/project/vendor/nette/http/src/Http/SessionSection.php(225): Nette\Http\SessionSection->start()
#6 /var/www/project/vendor/kdyby/facebook/src/Kdyby/Facebook/SessionStorage.php(135): Nette\Http\SessionSection->remove()
#7 /var/www/project/vendor/kdyby/facebook/src/Kdyby/Facebook/Facebook.php(602): Kdyby\Facebook\SessionStorage->clearAll()
#8 /var/www/project/vendor/kdyby/facebook/src/Kdyby/Facebook/Api/CurlClient.php(383): Kdyby\Facebook\Facebook->destroySession()
#9 /var/www/project/vendor/kdyby/facebook/src/Kdyby/Facebook/Api/CurlClient.php(197): Kdyby\Facebook\Api\CurlClient->resolveAPIException(Array)
#10 /var/www/project/vendor/kdyby/facebook/src/Kdyby/Facebook/Api/CurlClient.php(166): Kdyby\Facebook\Api\CurlClient->callOauth(Object(Nette\Http\UrlScript), Array)
#11 /var/www/project/vendor/kdyby/facebook/src/Kdyby/Facebook/Facebook.php(173): Kdyby\Facebook\Api\CurlClient->graph('/me', NULL, Array)
#12 /var/www/project/app/model/TokenServiceRepository.php(70): Kdyby\Facebook\Facebook->api('/me')
fprochazka commented 9 years ago

@bohdank have you tried using https://github.com/Kdyby/FakeSession ?