
@H_419_8@
@H_419_8@
Nsstring *params = [Nsstring stringWithFormat:@"{\"username\": \"%@\",\"password\": \"%@\",\"clIEnt_ID\": \"%@\",\"clIEnt_secret\": \"%@\"}",mFIEldUsername.text,mFIEldPassword.text,[NTDefaults clIEntID],[NTDefaults clIEntSecret]];NSLog(@"Params:\n%@",params);NSURL *url = [NSURL URLWithString:[[NTDefaults baseEndpointUrl] stringByAppendingString:@"/API/token.Json"]];ASIhttpRequest *request = [ASIFormDataRequest requestWithURL:url];[request addRequestheader:@"Content-Type" value:@"application/Json"];[request addRequestheader:@"Content-Length" value:[Nsstring stringWithFormat:@"%d",params.length]];[request setAuthenticationScheme:(Nsstring *) kcfhttpAuthenticationSchemeBasic];[request setUsername:@"user"];[request setPassword:@"pass"];[request setShouldPresentCredentialsBeforeChallenge:YES];[request setPostbody:[params dataUsingEnCoding:NSUTF8StringEnCoding]];NSLog(@"Post Body: %@",request.postbody);NSLog(@"headers: %@",request.requestheaders);NSLog(@"URL: %@",url.absoluteString);[request setDelegate:self];[request startAsynchronous]; 哪个回来了:@H_419_8@
错误:需要身份验证@H_419_8@
有没有人对此有任何想法?使用ASIhttpRequest成功验证了吗?@H_419_8@解决方法 我成功使用:
@H_419_8@
@H_419_8@
request.shouldPresentCredentialsBeforeChallenge = YES;[request addBasicAuthenticationheaderWithUsername:@"myUser" andPassword:@"myPass"];
我没有使用setAuthenticationScheme进行基本身份验证.@H_419_8@ 总结
以上是内存溢出为你收集整理的ios – ASIHTTPRequest基本身份验证失败全部内容,希望文章能够帮你解决ios – ASIHTTPRequest基本身份验证失败所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)