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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -