oAuth 和 Yammer [英] oAuth and Yammer

查看:55
本文介绍了oAuth 和 Yammer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用与各种社交媒体服务进行通信的 NodeJS 来设置内部 RESTful API.我们使用的其中一项服务是 Yammer.Yammer 使用 oAuth 进行验证,但它们提供永久验证令牌.出于某种原因,我在尝试 POST 时遇到了传递令牌的问题.从他们的文档看来,我所要做的就是在 URL 中发布所有内容.一个例子是

I am trying to set up an internal RESTful API using NodeJS that communicates with various social media services. One of the services we use is Yammer. Yammer uses oAuth for validation but they offer a permanent validation token. For some reason I am having issues passing the token when I try to POST. From their docs it appears that all I have to do is post everything in the URL. an example would be

POST https://yammer.com/mycompany.com/api/v1/messages.json?body=Testing&access_token=<myAccessToken>

当我这样做时,我没有得到回应.有什么我遗漏的吗?

When I do this I do not get a response. Is there something I am missing?

我还想补充一点,以这种方式测试 GET 也不起作用

I would also like to add that testing GET this way does not work either

GET https://yammer.com/mycompany.com/api/v1/messages.json?access_token=<myAccessToken>

推荐答案

Yammer API 需要OAuth 数据位于标头中.如果您查看他们的获取数据示例,您会看到请求如下所示.

The Yammer API requires the OAuth data to be in the header. If you look at their example for Getting Data, you'll see the request looks like.

GET/api/v1/messages/favorites_of/1234 HTTP/1.1

GET /api/v1/messages/favorites_of/1234 HTTP/1.1

主机:www.yammer.com

HOST: www.yammer.com

授权:OAuthoauth_consumer_key = KsTROcNF1Fx3e1PwA",组oauth_token = vlVH7A7DOm9wXuHdv58A",oauth_signature_method = PLAINTEXT",oauth_timestamp = 1297383841092",oauth_nonce = 1047685618",oauth_verifier = E4F8",oauth_signature = yPsEvDnNPIA8xGCFLvMJ73K0DD9ivMpATJeFOSo%26fSFh9UPkHQ6oRwK5OTne33ltnSnbQ9XrAhA72heg"

Authorization: OAuth oauth_consumer_key="KsTROcNF1Fx3e1PwA",oauth_token="vlVH7A7DOm9wXuHdv58A",oauth_signature_method="PLAINTEXT",oauth_timestamp="1297383841092",oauth_nonce="1047685618",oauth_verifier="E4F8",oauth_signature="yPsEvDnNPIA8xGCFLvMJ73K0DD9ivMpATJeFOSo%26fSFh9UPkHQ6oRwK5OTne33ltnSnbQ9XrAhA72heg"

OAuth 数据位于授权标头中,而不是在 URL 中.URL 中有任何 OAuth 数据的唯一时间是在您进行授权时.

The OAuth data is in the Authorization header and not in the URL. The only time you have any OAuth data in the URL is when you do the authorize.

这篇关于oAuth 和 Yammer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆