Alex Rivera | Logout

Resetting basic authentication credentials with AFNetworking

Asked 2012-01-27T19:17:34.523
8

I am writing a REST client (with AFNetworking) and need the ability to trigger the creation of a new session within a single instance of an application.

In other words, I would like to:
1 - Authenticate with server
2 - Do some REST calls
3 - Simulate "Log out"
4 - Re-authenticate with server
5 - Do some more REST calls

AFNetworking is great with making that initial authentication and REST calls, but I can't figure out how I would clear the session and "reset" the connection within the same instance.

When I used ASIHTTP, I just did:
[ASIHTTPRequest clearSession];

Is there a way to do something similar with AFNetworking?

Edit
Report

1 Answer

2

Even simpler.

[request setHTTPShouldHandleCookies:NO];
answered 2013-06-18T14:35:14.430

Your Answer