Closed DoctorsInTech closed 4 years ago
You use wrong keys in set method. Try to call it this way: xxx.set({ key: refTokenKey, value: refToken }.then.....
On Sun, Jul 5, 2020, 03:34 DoctorsInTech notifications@github.com wrote:
I am trying to store my refresh token on ios and android in the secure storage. For some reason, despite the storage reporting success on setting the value, it was not able to get the value on reloading.
On further investigation, it seems that the key and value are being set as undefined, so when i try to get the key 'refresh_token', it indeed does not exist.
Capacitor Doctor:
Latest Dependencies:
@capacitor/cli: 2.2.1
@capacitor/core: 2.2.1
@capacitor/android: 2.2.1
@capacitor/electron: 2.2.1
@capacitor/ios: 2.2.1
Installed Dependencies:
@capacitor/electron not installed
@capacitor/cli 2.1.2
@capacitor/core 2.1.2
@capacitor/android 2.1.2
@capacitor/ios 2.1.2
[success] Android looking great! 👌
Found 6 Capacitor plugins for ios:
@byteowls/capacitor-oauth2 (2.0.0) capacitor-secure-storage-plugin (0.4.0) cordova-plugin-androidx-adapter (1.1.1) cordova-plugin-camera (4.1.0) cordova-plugin-inappbrowser (4.0.1-dev) cordova-plugin-video-editor (1.1.3)
My code used to set the key value:
private useAccessToken(response) {
// tslint:disable-next-line:no-string-literal this.setupUser(response['access_token']); // store ref token and save it to local secure storage. this.refreshToken = response['refresh_token']; const refToken = this.refreshToken; const refTokenKey = 'refresh_token'; SecureStoragePlugin.set({ refTokenKey, refToken }).then( success => console.log('Refresh Token Stored: ', success) ) .catch(error => console.log('Error: ', error)); this.profileInfo = response['profile_info']; }
Why would be key be being set as undefined?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/martinkasa/capacitor-secure-storage-plugin/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHZRIH6IIBAK2YUIMXHKDCTRZ7KCHANCNFSM4OQUR5SQ .
I am trying to store my refresh token on ios and android in the secure storage. For some reason, despite the storage reporting success on setting the value, it was not able to get the value on reloading.
On further investigation, it seems that the key and value are being set as undefined, so when i try to get the key 'refresh_token', it indeed does not exist.
Capacitor Doctor:
My code used to set the key value:
Why would be key be being set as undefined?