I'm trying to properly respond to authentication challenges by overriding didReceiveAuthenticationChallenge. In the init method of my custom object, I take the user name and password passed in and create a NSURLCredential:
EWScreds = [NSURLCredential credentialWithUser: inUserName password: inPassword persistence:NSURLCredentialPersistenceForSession]; When I get an authentication challenge, I answer it with the stored credential: -(void)connection:(MyURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge previousFailureCount] == 0) { [[challenge sender] useCredential:EWScreds forAuthenticationChallenge:challenge]; } else NSLog(@"Authentication failed on attempt %d", [challenge previousFailureCount]); } This fails 100% of the time, even though the user name and password are correct. If I create a new credential using literal strings for the user name and password, like below, the auth challenge succeeds. NSURLCredential *newCreds = nil; newCreds = [NSURLCredential credentialWithUser: @"[EMAIL PROTECTED]" password: @"AGreatPassword" persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCreds forAuthenticationChallenge: challenge]; I’ve verified that the password and user names match in both credentials (by using the user and password accessors on the credential objects). They appear to match. I’d appreciate any suggestions on what I might be doing wrong with this. Thanks in advance! Cheers, _Paul _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]