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

save the authParams to session #418

Closed
eunion opened this issue Jan 13, 2016 · 2 comments
Closed

save the authParams to session #418

eunion opened this issue Jan 13, 2016 · 2 comments

Comments

@eunion
Copy link

eunion commented Jan 13, 2016

hi ,I hava a problem that i can not save the authParams to session.I use the Phalcon framework

The error is "Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'Closure' is not allowed' in [no active file]:0 Stack trace: #0 [internal function]: session_write_close() #1 [internal function]: Phalcon\Session\Adapter->__destruct() #2 {main} thrown in [no active file] on line 0".

how can i solve it!

@gfyrag
Copy link

gfyrag commented Jan 19, 2016

I had the same problem. Just saved the authParams fields in a flat dictionnary to restore it later.

@wgq91here
Copy link

i use symfony. i no problem.

use Symfony\Component\HttpFoundation\Session\Session;
$session = new Session();
$session->start();
...
$session->set('authParams', $authParams);

And notice is , don't save function in session. like it :

$checkUser = function ($username, $passwd) {
  $User_model = new RelationalExample\Model\Users;
  $user = $User_model->get($username);
  if (password_verify($passwd, $user[0]['password']) === true) {
    return $username;
  } else
    return false;
};
// error!
$server->getGrantType('password')->setVerifyCredentialsCallback($checkUser);
// don't out router
$router->post('/auth', ...

change it :

$router->post('/auth', function(...
  $server->getGrantType('password')->setVerifyCredentialsCallback($checkUser);
)

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

No branches or pull requests

4 participants