使用 Yammer Api 时返回无效的 OAuth 签名

发布于 2024-08-08 07:59:26 字数 1728 浏览 9 评论 0原文

我正在尝试编写一个从 Yammer 提取数据的小型 Web 应用程序。我必须通过 Yammer 的 OAuth 桥来访问他们的数据。我尝试使用 Oauth php 库 并进行 3 次握手。但在最后一步,我收到一条错误消息,指出我的 OAuth 签名无效。

以下是一系列步骤:

  1. 第一部分涉及获取请求令牌 URL,这些是我传递的查询参数。

     [oauth_version] =>; 1.0
        [oauth_nonce] => 4e495b6a5864f5a0a51fecbca9bf3c4b
        [oauth_timestamp] => 1256105827
        [oauth_consumer_key] =>我的消费者密钥
        [oauth_signature_method] => HMAC-SHA1
        [oauth_signature] => FML2eacPNH6HIGxJXnhwQUHPeOY=
    
  2. 完成此步骤后,我将获得请求令牌,如下所示:

    [oauth_token] =>; 6aMcbRK5wMqHgZQsdfsd [oauth_token_secret] => ro8AJxZ67sUDoiOTk8sl4V3js0uyof1uPJVB14asdfs [oauth_callback_confirmed] => true

  3. 然后,我尝试通过将参数传递到授权 url 来授权给定的令牌和令牌机密。它会将我带到 Yammer 的身份验证页面,在该页面中我允许我的应用程序与 Yammer 进行对话。

  4. 然后,Yammer 为我提供了一个 4 位数的代码,我必须将其放回到我的应用程序中,然后该应用程序会尝试获取永久访问令牌。我将以下信息传递到访问令牌 URL:

     [oauth_version] =>; 1.0
        [oauth_nonce] => 52b22495ecd9eba277c1ce6b97b00fdc
        [oauth_timestamp] => 1256106815
        [oauth_consumer_key] =>我的消费者密钥
        [callback_token] =>; 61A7
        [oauth_token] => 6aMcbRK5wMqHgZQsdfsd
        [oauth_token_secret] => ro8AJxZ67sUDoiOTk8sl4V3js0uyof1uPJVB14asdfs
        [oauth_callback_confirmed] =>真的
        [oauth_signature_method] => HMAC-SHA1
        [oauth_signature] => V9YcMDq2rP7OiZTK1k5kb/otMzA=
    
  5. 这里我应该接收 Oauth 永久访问令牌,但我得到的是无效的 Oauth 签名。我不知道我做错了什么。我使用相同的签名来签署请求。我应该使用新的令牌和密钥签署请求吗?我也尝试过,但没有成功。我什至尝试使用 signpost 库 在 java 中实现此功能,但陷入了完全相同的困境地方。帮助帮助!!

I am trying to write a small webapp that pulls data from Yammer. I have to go through Yammer's OAuth bridge to access their data. I tried using the Oauth php library and do the 3 way handshake. But at the last step, I get an error stating I have an invalid OAuth Signature.

Here are the series of steps:

  1. The first part involves getting the request Token URL and these are the query parameters that I pass.

        [oauth_version] => 1.0
        [oauth_nonce] => 4e495b6a5864f5a0a51fecbca9bf3c4b
        [oauth_timestamp] => 1256105827
        [oauth_consumer_key] => my_consumer_key
        [oauth_signature_method] => HMAC-SHA1
        [oauth_signature] => FML2eacPNH6HIGxJXnhwQUHPeOY=
    
  2. Once this step is complete, I get the request Token as follows:

    [oauth_token] => 6aMcbRK5wMqHgZQsdfsd
    [oauth_token_secret] => ro8AJxZ67sUDoiOTk8sl4V3js0uyof1uPJVB14asdfs
    [oauth_callback_confirmed] => true

  3. I then try to authorize the given token and token secret by passing the parameters to the authorize url.It takes me to Yammer's authentication page where I have allow my app to talk to Yammer.

  4. Yammer then gives me a 4 digit code that I have to put back into my application which then tries to acquire the permanent access token. I pass the following information to the access token URL:

        [oauth_version] => 1.0
        [oauth_nonce] => 52b22495ecd9eba277c1ce6b97b00fdc
        [oauth_timestamp] => 1256106815
        [oauth_consumer_key] => myconsumerkey
        [callback_token] => 61A7
        [oauth_token] => 6aMcbRK5wMqHgZQsdfsd
        [oauth_token_secret] => ro8AJxZ67sUDoiOTk8sl4V3js0uyof1uPJVB14asdfs
        [oauth_callback_confirmed] => true
        [oauth_signature_method] => HMAC-SHA1
        [oauth_signature] => V9YcMDq2rP7OiZTK1k5kb/otMzA=
    
  5. Here I am supposed to receive the Oauth Permanent access token, but instead I get a Invalid Oauth signature. I dont know what I am doing wrong. I use the same signaures to sign the request. Should I sign the request using the new token and secret? I tried that as well but to no avail. I even tried implementing this in java using signpost library and got stuck at the exact same place. Help Help!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

狂之美人 2024-08-15 07:59:26

callback_token 是 Yammer 在今年早些时候为响应 OAuth 安全建议而引入的东西。当 OAuth 1.0a 发布时,它被命名为 oauth_verifier。然而,Yammer 仍然支持他们的解决方法,但可能会重命名并再次尝试确定。

另外,以下是昨天来自Yammer开发网的信息:

明天我们将发布一些
将 Yammer API 更改为
方便用户网络开通
API 客户端。大部分的变化是在
OAuth 访问令牌调用哪个
允许您生成预授权
给定用户的 OAuth 访问令牌。
每一个都会生成一个代币
他们所在的网络和您的客户
通过发送API切换网络
与适当的人签署的请求
该网络的令牌。

我假设 Yammer OAuth 库可能需要根据此更改进行更新。我还没看呢。

编辑:我的python-yammer-oauth库仍然有效尽管 Yammer 改变了他们这边的事情。

编辑2:您可以尝试使用签名方法PLAINTEXT而不是HMAC-SHA1吗?我在使用 Yammer 和 HMAC-SHA1 时遇到了问题。

The callback_token was something Yammer introduced in response to an OAuth security advisory earlier this year. When OAuth 1.0a was released, it was instead named oauth_verifier. However, it's not unlikely that Yammer still supports their workaround but rename it and try again to be sure.

Also, the below is information from the Yammer Development Network yesterday:

Tomorrow we will be releasing some
changes to the Yammer API to
facilitate user network switching on
API clients. Most of the change is in
the OAuth Access Tokens call which
allows you to generate pre-authorized
OAuth access tokens for a given user.
One token will be generated for each
network they are in and your clients
switch networks by sending an API
request signed with the appropriate
token for that network.

I'm assuming that Yammer OAuth libraries might need to be updated per this change. I haven't taken a look at it yet.

Edit: My python-yammer-oauth library still works despite Yammer having changed things on their side.

Edit2: Could you try using signature method PLAINTEXT instead of HMAC-SHA1? I've had problems with Yammer and HMAC-SHA1.

我不在是我 2024-08-15 07:59:26

我尝试使用 PLAINTEXT.. 但对于这种方法,即使请求令牌,它也会给我相同的“无效的 OAuth 签名”错误。

那么是否可以生成我们使用 HMAC-SHA1 的访问令牌并访问实际的 API 方法,即发布消息......我们使用 PLAINTEXT?

I tried by using PLAINTEXT.. but for this method its giving me the same "Invalid OAuth signature" error even for requesting the token.

So is it possible to generate the access token we use HMAC-SHA1 and for accessing the actual API method i.e. for posting the message.. we use PLAINTEXT?

赏烟花じ飞满天 2024-08-15 07:59:26

刚刚发现问题!

我忘记在 CONSUMER_SECRET 末尾添加一个与号(“&”)。或许这也是你的问题?

just found the problem!

I had forgotten to add an ampersand ("&") at the end of CONSUMER_SECRET. Perhaps this is your issue as well?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文