Try this
NSURL *URL = [NSURL URLWithString:@"http://www.site.com/test_json_link/?username='USERNAME'&password='PASSWORD'"];
Now, to prevent my web server from redirecting to the login page. I created a middleware to handle the above url. My custom middleware has this in it:
if request.path != '/accounts/login/' and request.user.is_anonymous(): url = request.path.split('/')[1] if url == 'test_json': username = request.GET['username'] password = request.GET['password'] user = authenticate(username = username, password = password) if user is not None: if user.is_active: login(request, user)