Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

sap.ui.model.odata.ODataModel & CSRF Token

$
0
0

When creating my oModel, how to I ensure that the CSRF token will be returned so it will be available for subsequent POST's.

 

I was reading this article:

 

http://scn.sap.com/community/developer-center/front-end/blog/2014/01/19/ui5-application-approaches-for-performance-improvement

 

Specfically point #3 "Advice 3: To fetch the CSRF token, use a least resource intensive call. Think about using ODataModel to avoid this call all together."

 

I have tried a few methods but don't seem to be able to pull the CSRF token out after I create my model.  Here is how I am creating the model:

 

 

var sServiceUrl = "<server>/sap/opu/odata/sap/<service>/";

 

var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, false, "<uname>", "<pword>"); //removed mHeaders and bTokenHandling

 

In the above case I am not passing the extra parameters mHeaders and bTokenHandling beacause I could not get them to work for me, any thoughts how how the oModel create is setup so that the csrf token would be available right after its built?

 

 

Thanks, Mike


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>