I have an Sdk to call which returns an applicationID that I need to store in my django application so that if the user is approved can then move to the next page. I trying to save in JS sessionStorage than pass the data to another html page where I'm using ajax to pass it to my django views, the problem is that I need to have this data unique for the user that is logged in. How can I link this data to the current user logged in and so on?
const widget = window.getidWebSdk.init({ apiUrl: '', sdkKey: '', containerId: "targetContainer", flowName: '',
onComplete: (data) => {
console.log(JSON.stringify(data))
let appId = data;
console.log(data)
sessionStorage.setItem("appId", JSON.stringify(appId))
window.location.href = "/kycsubmit";
return;
}, onFail: ({ code, message}) => { console.log("something went wrong: " + message )},
});
second html page
let application = JSON.parse(sessionStorage.getItem("appId"));
let kycStatus = application.applicationId
$.ajax({
type: "GET",
dataType: "json",
url: `api/application/${kycStatus}`,
headers: {
'Content-Type': 'application/json',
'X-API-Key': '',
},
success: function(data) {
document.getElementById("test").innerHTML = data.overallResult.status
document.getElementById("test-1").innerHTML = application.applicationId
console.log(data.overallResult.status)
}
})