PDA

View Full Version : [CLOSED] Cookie not sent in extdirect request



Psychokrameur
20 May 2014, 3:07 AM
Hello,

Sorry it's hard for me to create a test case.
In appear that there is regression from 4.2.2 to 5.0 beta on Ajax implementation.

When I set :


Ext.Ajax.on("beforerequest", function(conn) {
conn.withCredentials = true; // especially this line
conn.cors = true;
});

The cookie is still not send in version 5.0 (work well on 4.2.2).

See this (short) discussion for more detail : https://github.com/ralscha/extdirectspring/issues/126

Thanks in advance,
Psychokrameur

mitchellsimoens
20 May 2014, 4:10 AM
Thanks for the report! I have opened a bug in our bug tracker.

TonySteele
11 Jun 2014, 2:32 PM
Hope this is fixed soon, this issue has stopped the port of my application to Extjs 5, it relies on token in the domain cookie for authorisation on the server api.

Is there any work around?

Psychokrameur
24 Jun 2014, 11:49 PM
Hello,

Does this bug has been fixed by the 5.0 release?

Thanks in advance

ralscha
7 Aug 2014, 9:53 PM
Ext.Ajax.on("beforerequest", function(conn) {
conn.withCredentials = true; // especially this line
conn.cors = true;
});


Hi

Just figured out that this is not a bug. Because of the new config system in extjs5 you have to use the setter methods



Ext.Ajax.on("beforerequest", function(conn) {
conn.setWithCredentials(true);
conn.setCors(true);
});

Or use the second parameter of the beforerequest event handler (options)



Ext.Ajax.on("beforerequest", function(conn, options) {
options.withCredentials = true;
options.cors = true;
});

Maybe the second solution is better because it sets the options on a per request basis. The first approach sets the two options globally.

This works with 5.0.0 and 5.0.1

Ralph

Psychokrameur
22 Aug 2014, 5:45 AM
Thanks a lot!

Simple... just figured out and understood what changes between the two version in the core...