Is it possible to reset NSURLConnection after providing credentials?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-09T00:10:16Z Indexed on 2010/04/09 0:13 UTC
Read the original article Hit count: 649

Filed under:
|

I am calling a REST service that requires basic auth and I respond to the didReceiveAuthenticationChallenge delegate OK

    NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:self.user password:self.password persistence:NSURLCredentialPersistenceForSession];
    [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
    [credential release];

The Credentials are valid for the Session but I would like for my App to be able to switch between servers and therefore need to "reset" the Session so it asks again for a challenge.

I can of course try the option of not storing the credentials for the Session and supply them for each call but this does not seem like a good idea.

Any ideas would be appreciated!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone