Good Day,
How can I retrieve a value and/ a key on Page 1 for instance, if it was stored using secure storage on the Startpage of a stackview layout. I have tried the value method however I am not successful. For example:
1. Start Page would look something like
TextField {
id: key
placeholderText: "Enter key"
}
TextField {
id:value
placeholderText: "Enter value"
anchors.left: key.right
}
//Click on the button to store data into keychain
Button {
id: SecureButton
text: qsTr ("Secure Data")
anchors.left: key.bottom
onClicked: {
SecureStorage.setValue(key.text, value.text)
}
}
2. Page 1 would look something like
//Click on button to retrieve data
Button {
id: retrieveButton
text: qsTr ("Retrieve Data")
anchors.top: secureButton.bottom
onClicked: {
retrieveData.text = qsTr("Value:") + SecureStorage.value(key.text)
}
}
//Display retrieved data
Text {
id:retrieveData
anchors.top: retrieveButoon.bottom
The information is being stored however I can not retrieve the information.
Solved! Go to Solution.
I think the issue is that the key and value components with their associated properties aren't available to the Page 1 view in the stack since they are defined in Start Page and aren't global or passed to Page 1.
Giatri,
That should work, what is the error message? Did you make sure to have the import statement in the other page?
Please refer to this documentation page for Secure Storage and sample page.
Thank you,
Erwin.
I think the issue is that the key and value components with their associated properties aren't available to the Page 1 view in the stack since they are defined in Start Page and aren't global or passed to Page 1.
Good Morning,
How can I rectify this? Thank you.
Hi Giatri:
I'm not sure if there are security implications to these but you would need to either:
So Number 1 above would look something like this:
App {
id: app
width: 400
height: 750
property string secureStorageKeyValue: ""
.....
//Click on the button to store data into keychain
Button {
id: SecureButton
text: qsTr ("Secure Data")
anchors.left: key.bottom
onClicked: {
app.secureStorageKeyValue = key.text;
SecureStorage.setValue(key.text, value.text);
}
Page 1
Button {
id: retrieveButton
text: qsTr ("Retrieve Data")
anchors.top: secureButton.bottom
onClicked: {
retrieveData.text = qsTr("Value:") + SecureStorage.value(app.secureStorageKeyValue);
}
}
Number 2
StartPage {
id: startPage
property string secureStorageKeyValue: ""
//Click on the button to store data into keychain
Button {
id: SecureButton
text: qsTr ("Secure Data")
anchors.left: key.bottom
onClicked: {
startPage.secureStorageKeyValue = key.text;
SecureStorage.setValue(key.text, value.text);
}
yourStackView.push( pageOneViewId, { "secureStorageKeyValue": startPage.secureStorageKeyValue } );
}
PageOne {
id: pageOne
property string secureStorageKeyValue: ""
Button {
id: retrieveButton
text: qsTr ("Retrieve Data")
anchors.top: secureButton.bottom
onClicked: {
retrieveData.text = qsTr("Value:") + SecureStorage.value(secureStorageKeyValue);
}
}
I had a chance to try both. I don't think any work for me. The second option gave alot of errors and the first is giving me the results as seen in the picture. I dont not know how to proceed. For privacy reasons, I do not want to share my code on here but if I can get that to you, maybe you'd be able to see the results yourself. Please advise accordingly. Thank you in advance.
I would recommend working with Esri Technical Support for further troubleshooting.
I do not get any response from Esri Technical Support when I post a question.
Our apologies, what I was trying to say is, you should contact Esri Technical Support, Esri Support Contact Support , via phone call, email or chat.