cancel
Turn on suggestions
Showing results for
Search instead for
Did you mean:
The next set of progression badges have been announced! Let's Discuss!
Read only

Cloud foundry oData Provisioning oModel.refreshSecurityToken(); doesn't fetch x-csrf-token

saikrishna186
Active Participant

2 weeks ago

0 Kudos
133

Hi There,

Good day !I am working on a NEO to CF migration project.

Info: In CF scenario we have oData provisioning since multiple destinations.

Issue:

  • Existing app with file upload functionality have the regular approach of
  • oModel.refreshSecurityToken(); to fetch x-csrf-token
  • And oModel.getHeaders()["x-csrf-token"] to retrieve the token, which is then passed as header field.
  • When I do oModel.refreshSecurityToken(); in network call request headers I can see x-csrf-token: Fetch, but in response headers I don't see the parameter x-csrf-token
  • When I try to retrieve the same by oModel.getHeaders()["x-csrf-token"] its undefined.
Can you please advise what am I doing wrong,
Data source definition is manifest.json:
"commonService": {
"uri": "/sap/opu/odata/sap/XXXXXXX_srv/",
"type": "OData",
"settings": {
"annotations": [],
"localUri": "localService/commonService/metadata.xml",
"odataVersion": "2.0"
}
}
Model Definition in Manifest.json
"common": {
"dataSource": "commonService",
"preload": true,
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"useBatch": true,
"defaultBindingMode": "TwoWay",
"defaultCountMode": "Inline",
"defaultUpdateMethod": "PUT"
}
}
UploadSetwithTable method beforeUploadStarts (part of the code)
var oModel = this.getView().getModel("common");
oModel.refreshSecurityToken();
this.uploadAttachments.addHeaderField(new CoreItem({
key: "x-csrf-token",
text: oModel.getHeaders()["x-csrf-token"]
}));

Can you please advise, as I couldn't understand what am I doing wrong, or is there a different approach since oData Provisoning unlike direct backend destination connection.
Thank you in Advance,
Sai

Know the answer?

Help others by sharing your knowledge.

Answer

Need more details?

Request clarification before answering.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

Accepted Solutions (0)

Answers (0)

Ask a Question

AltStyle によって変換されたページ (->オリジナル) /