开发者

oAuth and Yammer

I am trying to s开发者_如何学Goet 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?

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>


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

HOST: www.yammer.com

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"

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.


I've created this gist where I used the Yammer API to post a status after a build completion through Fabric. Its in Python, but possibly it can point you in the right direction.

I am assuming you got the right Access Token though, as thats critical.

I recommend using this library to get the access token, as its pretty simple and easy to use. This will ensure you have the right access token.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜