PDA

View Full Version : Sencha Touch 2 Session problem



adi.shoukat
21 Oct 2012, 10:26 AM
I am calling the APIs of my web-service to run the Sencha touch application.
When I hit the login API directly from browser, it sets the SESSION variable that I can access later.


But when I call the same API diagrammatically from my Sencha Touch Application it logs me in successfully but it doesn't set the SESSION variables. i.e. I cannot access the session variables in further APIs.


I am not sure if the problem is on Client side or on Server side. Any thoughts?

(Using Coldfusion as server side language)

adi.shoukat
21 Oct 2012, 1:18 PM
Fixed !!
In response of Login API I also returned #SESSION.CFID# and #SESSION.CFTOKEN#
Now with every API I am sending these variable: ?CFID=123&CFTOKEN=334455
And finally the Coldfusion can recognize my session :)

anantasaurabh
11 Mar 2013, 3:35 AM
This information might be useful to others.
when making an ajax request to cross domain session state is not maintained.
you need something like this.



Ext.Ajax.request({ url: 'http://myurl/log_user_in.json', params: { username: user, password: pass, app_id: id }, withCredentials: true, useDefaultXhrHeader: false, method: "POST" })
more info here
http://stackoverflow.com/questions/11170488/getting-cookies-in-sencha-touch-2-0-using-ajax-request