Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c XCode OAuth请求访问“令牌调用”;4013->;HTTP/1.1 401所需授权”;_Objective C_Xcode_Magento_Oauth - Fatal编程技术网

Objective c XCode OAuth请求访问“令牌调用”;4013->;HTTP/1.1 401所需授权”;

Objective c XCode OAuth请求访问“令牌调用”;4013->;HTTP/1.1 401所需授权”;,objective-c,xcode,magento,oauth,Objective C,Xcode,Magento,Oauth,我已经设法进入了由Magento实现的OAuth协议的第三部分 首先,请求令牌调用返回一个令牌,我在UIWebView中向用户显示授权对话框,并在用户按下“Authorize”后提取令牌/验证器 我使用这些参数调用access_令牌url OAuth realm="", oauth_timestamp="1339756083", oauth_nonce="d1dc184d236756c42210b746a887edb5bd69cf44", oauth_signature_method="H

我已经设法进入了由Magento实现的OAuth协议的第三部分

首先,请求令牌调用返回一个令牌,我在UIWebView中向用户显示授权对话框,并在用户按下“Authorize”后提取令牌/验证器

我使用这些参数调用access_令牌url

OAuth realm="", 
oauth_timestamp="1339756083",
oauth_nonce="d1dc184d236756c42210b746a887edb5bd69cf44", 
oauth_signature_method="HMAC-SHA1", 
oauth_consumer_key="{censored}", 
oauth_version="1.0", 
oauth_token="912i72lcu6vzlwk6a3vdj4a3sstbdzqp",
oauth_token_secret="t5cg9qlykkk9411iv0rbul0gnw9fsa0m", 
oauth_verifier="9vu02kbymodo63pve091otffvy53rhlf",
oauth_signature="fDwWGeJhatIX6kK4nb%2Bagp4C%2FxU%3D"
这是我的Obj-C代码的一部分

NSMutableArray* values = [[NSMutableArray alloc]initWithObjects:self.requestToken,self.requestSecret,verifier, nil];
NSMutableArray* keys = [[NSMutableArray alloc]initWithObjects:@"oauth_token", @"oauth_token_secret", @"oauth_verifier", nil];
NSDictionary* extraParams = [[NSDictionary alloc] initWithObjects:values forKeys:keys];

OAuth* oauth = [[OAuth alloc] initWithConsumerKey:OAUTH_CONSUMER_KEY andConsumerSecret:OAUTH_CONSUMER_SECRET];

NSString* authHeader = [oauth oAuthHeaderForMethod:@"POST" andUrl:ACCESS_TOKEN_URL andParams:extraParams];
NSLog(@"%@", authHeader);
ASIHTTPRequest* request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:ACCESS_TOKEN_URL]];
[request addRequestHeader:@"Authorization" value:authHeader];
这是品红作为回报告诉我的

2012-06-15 12:28:06.052 Versmissen[2175:707] 401 3-> HTTP/1.1 401 Authorization Required  -> (null) -> http://{censored}/oauth/token

然而,4013不在API中解释的OAuth错误列表中。我一辈子都搞不清楚到底出了什么问题

固定。需要使用请求_secret对身份验证标头进行签名

NSString*authHeader=[self.oauth OAuthHeadPerformMethod:@“POST”和URL:ACCESS\u TOKEN\u URL和params:extraParams和tokensecret:self.requestSecret]

:)