var*_*run 4 xcode objective-c ios instagram instagram-api
response从取得我的照片时得到了以下内容Instagram。请帮助任何帮助,将不胜感激。
{
code = 403;
"error_message" = "Invalid signed-request: Missing required parameter 'sig'";
"error_type" = OAuthForbiddenException;
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码
NSURL *url = [NSURL URLWithString:@"https://api.instagram.com/v1/tags/nofilter/media/recent?access_token=...........aef2"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if (error){
}
else {
NSString * a = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSDictionary *tokenData = [jResponse objectWithString:a];
NSLog(@"%@",tokenData);
}
}];
Run Code Online (Sandbox Code Playgroud)
看起来您已启用Enforce Signed Requests,因此它要求您具有sigAPI请求签名的参数,如下所述:https : //www.instagram.com/developer/secure-api-requests/
生成签名或禁用签名 Enforce Signed Requests
看起来您正在从应用程序(客户端)进行API调用,因此不建议发出已签名的请求,因为您必须将s保存client_secret在应用程序代码中。为了安全起见,建议在服务器上执行此操作。因此,只需禁用Enforce Signed Requestsfor your app并按原样进行API调用。