调用POST请求时是否需要Enforce Signed Header?

Is the Enforce Signed Header required when calling the POST request?

在创建我的 Android 应用程序时,我一直在努力为我的 Feed 上的照片点赞,如果我没记错的话,解决方案是在创建 instagram [=46] 时提供强制签名 Header =].但是,如果我查看 API 文档,它会显示:

Important Note Your Client Secret should be kept secure at all times. Do not share this Secret with anyone, do not include it in java-script code or a mobile client. Mobile apps that do not have a server-side component should not use the Enforce signed header setting. You have the ability to reset your Client Secret to a new value at any time, if you suspect that it was leaked.

但是,当我禁用 Enforce Signed Header 时,点赞不起作用。使用 Enforce Signed Header 时,我通过 HTTP 请求 http://myip.dnsomatic.com/ 提供设备的远程 IP 来解析网页。

再次引自开发者 API:

The following endpoints require the X-Insta-Forwarded-For header if Enforce signed header is enabled:

  • POST /users/{user_id}/relationship
  • POST /media/{media_id}/comments
  • DEL /media/{media_id}/comments/{comment_id}
  • POST /media/{media_id}/likes
  • DEL /media/{media_id}/likes

所以基本上它说(我从这句话中得到的)是这些端点需要 X-Insta-Forwarded-For header 如果启用强制签名 Header。所以这意味着如果强制签名 Header 被禁用,他们不需要 header。

我这样做是否正确,或者我是否可以在没有 Enforce Signed Header 的情况下点赞照片和视频?

我会在今天晚些时候编辑这个和 post 一个日志,当我想给一张没有强制签名的照片点赞时 Header。谢谢!

另一个快速问题,在上面文档的引用中,他们说不要在代码中包含客户端密码,但是创建 Instagram 需要客户端密码 object。你是如何解决这个挑战的?现在我将客户端密钥存储在我的应用程序的加密密钥中,这是一个好方法吗?

感谢您的所有提示,

蒂姆

我错了,在 Instagram 上使用 post 请求不需要强制签名 Header。使用我的应用程序时清洁 logcat。

谢谢!

如果你不使用 Enforce Signed Header(和 X-Insta-Forwarded-For),那么你仍然可以点赞、评论和 follow/unfollow,但你将有下限 liking/hour 或follow/hour.

检查此页面以了解使用签名呼叫与未签名呼叫时的限制: http://instagram.com/developer/limits/