Re: [Cppcms-users] json_rpc_server sessions
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-02-10 09:09:30
|
First of all, please registerto the mailing list so I will not have to approve the mails. Do you use synchronous or asynchronous applications? If you use asychronous one you need to call load() explicitly. http://cppcms.com/cppcms_ref/latest/classcppcms_1_1session__interface.html#details Also this part (this)->session().["auth_token"]; Seems to have problems i.e. session().[...] < note the point after ")" and before "[". Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Sergiu Adrian <ser...@ya...> >To: "cpp...@li..." <cpp...@li...> >Sent: Thursday, February 7, 2013 12:47 AM >Subject: [Cppcms-users] json_rpc_server sessions > > >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://www.sosetaria.ro/ > >------------------------------------------------------------------------------ >Free Next-Gen Firewall Hardware Offer >Buy your Sophos next-gen firewall before the end March 2013 >and get the hardware for free! Learn more. >http://p.sf.net/sfu/sophos-d2d-feb >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |