I’m trying to access the shared iCloud Keychain in my Ionic application, but it’s not working.
I have another MacOS app that writes some data under this path:
com.app.keychain.token
And these data are available and shared within another iOS app of mine, so the iCloud keychain works.
Now I’m trying to connect it to a third Ionic app. In Xcode I have enabled SignIn&Capabilities > Keychain Sharing > KeychainGroup
as com.myAccount
(same as in the iOS and MacOS apps), and then wrote this code
import { Keychain } from '@ionic-native/keychain/ngx';
let keychainId = 'com.app.keychain'
let keychainTokensId = 'token'
let keychain = new Keychain()
console.log(keychainId+'.'+keychainTokensId)
keychain.get(keychainId+'.'+keychainTokensId)
.then(value => console.log('Got value', value))
.catch(err => console.error('Error getting', err));
But it always returns null
. (I’ve tested on a real device with the correct AppleId and some data under that keychain path)
NB: in my iOS and MacOS app the Keychain Group (com.myAccount
) differs from the path I use to store the data (com.app.keychain.token
), I don’t know if this may cause some problem, anyway on iOS-MacOS keychain sharing works.
What am I missing?
Thanks
1 post - 1 participant