Search code examples
iosobjective-cafnetworkingsskeychain

Using SSkeychain to store access_token & user login - AFNetworking


I'm trying to store the users username, password and the access_token the user gets when logging in. I have searched a lot and found others with similar problems. But I'm still pretty new in xcode and objective-c, so I don't know how to use this SSKeychain library: Soffes/SSKeychain


Solution

  • To store the value in Keychain use the below code -

    [SSKeychain setPassword:tfPAssword.text forService:@"UserPassword" account:@"com.myApp.app"];

    To retrieve the value use below code

    NSString *password = [SSKeychain passwordForService:@"UserPassword" account:@"com.myApp.app"];