changing username and password for RKObjectManager

262 views
Skip to first unread message

equinox

unread,
May 20, 2011, 8:57:26 PM5/20/11
to RestKit
I have tried changing the password and username by doing:


[RKObjectManager sharedManager].client.username = username;
[RKObjectManager sharedManager].client.password =
[SFHFKeychainUtils getPasswordForUsername:username
andServiceName:@"convore" error:&error];

However, when calling my objectLoader it still uses the old username
and password.. why is this? I printed the

[RKObjectManager sharedManager].client.username

and it is changed to the new username, however it still loads using
the old username, why is that?

Chad Podoski

unread,
May 20, 2011, 11:31:59 PM5/20/11
to res...@googlegroups.com
Take a look at the 'Bug or Issue with Headers/RKClient username,password???' thread just before your post.

equinox

unread,
May 21, 2011, 12:04:17 AM5/21/11
to RestKit
You're saying that I chould clear the cache by using:

connectionShouldUseCredentialStorage?

where should I call this and how?

equinox

unread,
May 21, 2011, 12:21:28 AM5/21/11
to RestKit
I've added:

- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection
*)connection
{
return NO;
}


at my RKRequest.m and still it caches the first username and password
that I've set.
I need a way to stop this please, anyone....

Chad Podoski

unread,
May 21, 2011, 3:09:35 AM5/21/11
to res...@googlegroups.com
The delegate method (connectionShouldUseCredentialStorage:) should be added in RKResponse.m just below:

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

Updating the RKClient with the new username/password and adding the delegate method cleared up logging in/out for me.  Hope that helps!

Jon Phillips

unread,
May 22, 2011, 3:38:45 PM5/22/11
to RestKit
Chad and others,

Thanks for your help so far with this issue! I'm still banging my
head against the wall on it. I've put that delegate where Chad
suggests, and have a logger in there to ensure it's getting called.
When it's called, I also output the current _request.username and
_request.password, and they are for the NEW credentials I want to
use. But when I have Rails tell me the current user logged in on the
server side with that request, it's my OLD username.

Any other suggestions?

Jon

J Folkins

unread,
May 22, 2011, 4:13:21 PM5/22/11
to res...@googlegroups.com
Jon,

Several quick thoughts 

1) From the command line (cli) what do you get if you grep for the old credentials in the root directory of your project?

grep -nR "YOUR_OLD_USERNAME" /path/to/project/

2) Have you deleted the old application entirely? Then rebuilt and reinstalled? Maybe there is a cached value?

3) I also would install wireshark and sniff the packets that are being sent.



-jared

Blake Watters

unread,
May 27, 2011, 12:58:59 PM5/27/11
to res...@googlegroups.com
I have opened up a Github issue on this: https://github.com/twotoasters/RestKit/issues/127

Will look at it post object mapper 2.0
Reply all
Reply to author
Forward
0 new messages