Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Can't print 'Authenticate' content in request !!! #50

Open
zhoubo2015 opened this issue May 29, 2018 · 0 comments
Open

Can't print 'Authenticate' content in request !!! #50

zhoubo2015 opened this issue May 29, 2018 · 0 comments

Comments

@zhoubo2015
Copy link

zhoubo2015 commented May 29, 2018

Response:
{ status code: 401, headers {
"Cache-Control" = private;
"Content-Language" = en;
"Content-Length" = 951;
"Content-Type" = "text/html;charset=utf-8";
Date = "Tue, 29 May 2018 07:32:43 GMT";
Expires = "Thu, 01 Jan 1970 08:00:00 CST";
Server = "Apache-Coyote/1.1";
"Www-Authenticate" = "Digest realm="My Realm", qop="auth", nonce="1527579163026:3643c85f69be9ac55a4a42d87fe69dab", opaque="A09625523209ADC9E967098F1F0C1491"";
} }

After above response, I can't print next Request content, include ‘Authenticate’!

This is deal Challenge code:
[self.sessionManager setSessionDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing _Nullable * _Nullable credential) {
*credential = [[NSURLCredential alloc] initWithUser:@"tomcat" password:@"tomcat" persistence:NSURLCredentialPersistenceForSession];
return NSURLSessionAuthChallengeUseCredential;
}];
[self.sessionManager setTaskDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing _Nullable * _Nullable credential) {
*credential = [[NSURLCredential alloc] initWithUser:@"tomcat" password:@"tomcat" persistence:NSURLCredentialPersistenceForSession];
return NSURLSessionAuthChallengeUseCredential;
}];
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant