ios - Storing access token and refresh token in KeyChain -
i know how store access token, refresh tokens , expirations in ios keychain.
all examples have seen seem store 1 key-value combination. how store multiple key values 1 keychain identifier?
if there better way store above, please let me know.
you first want build nsdictionary key/values want. next, use lockbox store nsdictionary keychain, using provided setdictionary:forkey:
interface.
update: change values stored in dictionary, have pass nsmutabledictionary
(that's common way of doing):
nsmutabledictionary *mutabledict = [[lockbox dictionaryforkey:@"yourrefreshtokendictionarykey"] mutablecopy]; mutabledict[@"access_token"] = @"newaccesstoken"; [lockbox setdictionary:mutabledict forkey:@"yourrefreshtokendictionarykey"];
fyi, nsmutabledictionary
subclass of nsdictionary
, it's safe save directly keychain!
Comments
Post a Comment