问题描述
为了使签名API调用的Instagram的方法,后跟随用户,比如用户的形象等,用户有每小时20遵循的限制。但是,如果我们把签名API调用,然后用户可以每小时60跟随。但我的问题是,如何让签名API调用。 ?
To make the Signed API calls for Instagram post methods to Follow user, Like user's image etc. Users Have limit of 20 Follow per Hour. But if we make Signed API call then user can make 60 Follow per hour. But My question is how to make Signed API call. ?
这个方法我试过Instagram上的desribed ,并请强制头能。而发送 X-的Insta - 转发,对于
头凭有效证件现场。但仍有20后跟着它显示极限误差。任何人都可以请帮我如何签名API调用。
I tried this method as desribed on Instagram http://instagram.com/developer/restrict-api-requests/ and Make Enforced header enable .and Sent X-Insta-Forwarded-For
header field with valid Id. But still after 20 follow it is showing Limit error. Can anyone please help me to how to make Signed API call .
先谢谢了。
推荐答案
搜索的事情后,我解决我的问题,这样,通过使我的应用程序签署
After searching for the things I resolved my issue by this, By making my app signed app:
进行签名API调用Instagram的用户需要检查无论在自己的应用程序斯塔的复选框。在管理客户端。并且必须按照。
to make Signed API call for Instagram user need to check both the checkbox in their insta App. under manage clients. and Have to follow The Implicit OAuth Grant flow.
有关都遵循/后一样类型请求用户需要添加一个头:
Type为
For All Follow/Like post type request user need to add one header:of Type as
X-的Insta - 转发,对于
- > [IP信息] | [签名]
IP应该是它的客户端的远程IP由你的应用程序的负载平衡器检测;
签名,申请一个带有HMAC SHA256,并追加签名的十六进制再presentation那里。在使用 clientSecret
为重点的 IP地址
数据。
然后,使用管道加入IP信息及签署 |
,并设置为标题字段的值
IP should be it the client's remote IP as detected by the your app's load balancer;Signature is , apply an HMAC with SHA256, and append the hex representation of the signature there . On the IP address
as data using your clientSecret
as key.Then join IP info and Signature using pipe |
and set that as the value of the header field.
我用下面的code生成签名:
I had used the following code to generate Signature:
-(NSString *)signWithKey:(NSString *)key usingData:(NSString *)data
{
const char *cKey = [key cStringUsingEncoding:NSASCIIStringEncoding];
const char *cData = [data cStringUsingEncoding:NSASCIIStringEncoding];
unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH];
CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), cData, strlen(cData), cHMAC);
NSData *HMAC = [[NSData alloc] initWithBytes:cHMAC length:sizeof(cHMAC)];
return [[HMAC.description stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""];
}
-(NSString*)getheaderData
{
NSString *ipString = [self fetchMyIP];
NSString *signature = [self signWithKey:kClientSecret usingData:ipString];
}
To set header in iOS: [request setValue:[self getheaderData] forHTTPHeaderField:@"X-Insta-Forwarded-For"];
因此,API调用将被作为签名的API调用。
So the API call will be sent as the Signed API call.
这篇关于Instagram的签名API调用从iOS版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!