[Cppcms-users] json_rpc_server sessions
Brought to you by:
artyom-beilis
|
From: Sergiu A. <ser...@ya...> - 2013-02-06 22:47:12
|
Hello,
I am trying to make an api based on the json_rpc example. The class is called my_api:
class my_api: public cppcms::rpc::json_rpc_server {...}
I have a method, for example authenticate:
void my_api::authenticate(std::string password){
std::string auth_token;
if ((this)->session().is_set("auth_token")) {
auth_token = (this)->session().["auth_token"];
} else {
auth_token = "invalid";
}
(this)->session()["auth_token"] = "some_value";
std::cout << "token: " << auth_token << std::endl;
(this)->session().save();
return_result("authentication");
}
The config is set to save the session in server memory:
"session" : {
"location" : "server",
"expire" : "browser",
"server":{
"storage":"memory"
}
}
The problem is that the session isn't saved. The auth_token is always "invalid". Can you help me with some tips on how to use the session in this situation?
Thank you,
--
Fatol Sergiu Adrian
Team Leader & Senior PHP Developer
Arobs Transilvania Software
adi...@ar...
Skype: sergiu.adrian
Olimpia Business Center
98-100 Dorobantilor, 2nd Floor
400609 Cluj-Napoca Romania
Co-Founder -- Sosetaria.ro
http://sosetaria.ro
|