【发布时间】:2013-02-13 22:08:51
【问题描述】:
我需要一些关于clojure and oauth 的帮助。
我在最后一步卡住了:使用凭据签署请求。
(def credentials (oauth/credentials consumer
(:oauth_token access-token-response)
(:oauth_token_secret access-token-response)
:POST
"http://twitter.com/statuses/update.json"
{:status "posting from #clojure with #oauth"}))
(http/put "http://twitter.com/statuses/update.json"
:query-params credentials)
这是来自 github 的示例。
现在,从 flickr API 我有这个测试网址:
http://api.flickr.com/services/rest/?method=flickr.people.getPhotos
&api_key=82d4d4ac421a5a22et4b49a04332c3ff
&user_id=93029506%40N07&format=json&nojsoncallback=1
&auth_token=72153452760816580-cd1e8e4ea15733c3
&api_sig=b775474e44e403a79ec2a58d771e2022
我不使用 twitter...我使用 flickr api 并想获取用户的图片。
我现在的问题是:如何更改适合 flickr url 的凭据?
我也对:status 感到困惑,但是当我删除它时,我得到一个错误...
【问题讨论】:
-
那个 api_key 应该是秘密的吗? 82d4...?
-
它只是一个测试密钥,将在几个小时后过期......但我现在改变了数字......也许更安全;)
-
如果您提供真实代码(无密钥)而不是 twitter 示例,将会很有帮助。
-
FWIW,这是一个也使用这个库的存储库(虽然也是 twitter):github.com/borkdude/whosnotfollowingme
-
嘿,我知道你说你想使用使用 clj-oauth 的解决方案,而 Flickr 使用 OAuth 1,但我刚刚写了一篇关于使用 LinkedIn API (OAuth 2) 的条目,没有任何 oauth框架,我相信它可能有用(以防万一,整个 OAuth 和 104 行 Clojure 中的查询)。链接:malagastockholm.wordpress.com/2013/05/19/… 和回购:github.com/kikofernandez/clojure-linkedin