MAking API 请求总是收到“token_rejected”错误

发布于 2024-11-06 13:11:50 字数 1878 浏览 2 评论 0原文

我开发了一个OAuth组件,并完成了Yahoo的OAuth流程,得到了oauth_token。

但是,当我对 yahoo API(如联系人或 YQL)进行 API 调用时,我总是收到“Token_Rejected”错误消息。

HTTP 401

签名:6fR3VdygGrRCO+WrS6tlD3hjHMI=

base_string:

GET&http%3A%2F%2Fsocial.yahooapis.com%2Fv1%2Fuser%2FMOMJS2M2KSMQKT2D
Q4O7NS4JFU%2Fprofile%2Fusercard&oauth_consumer_key%3Ddj0yJmk9ZmZzUFVQblZzM1JVJmQ
9WVdrOU9GbFNRMUJuTmpRbWNHbzlOVFUyTWpRNU9EWXkmcz1jb25zdW1lcnNlY3JldCZ4PTJk%26oaut
h_nonce%3D2366072fe9829333b98eb6f2a7539afa%26oauth_signature_method%3DHMAC-SHA1%
26oauth_timestamp%3D1305099596%26oauth_token%3DA%3D4cnEo.njj1_C6XtkvR3o5x3vOYqrN
hHk3sBFh76pPtcKA07WF69OADx8zU7o0dPSRauN77UIBw.5bEk5opw15A8SSemxquErvhhHPuAhtm0SB
UuGBOSMxapwBdU1.E4oeQQMXIvKRFhy81EVbIDclBcxzeG.y.eEUdNFDkp_suVAKko.i6Tazpbfkqa1C
__7BAQO5m74CIsalgwyyI8z99eITPlzq_llb7CZzhoWJTVzVAVH_hoU2jBbjSwP00AGB.ovXqT0Ayf0.
WHG2v7hhFhVh.MEx6H0oa8rgpUSZr68dViiIPLfV6G.fGCF3GSnE4uVNiDWM2.x4Lf37slpGWqmjUTtX
B8UVlTQU0auc_YCbGC9wSiUHePWEhpzkgQ6lf.G0mZ9VJ5I_9jbZzlJD52ffUoMDVs97qEeT4CRRa.0p
hwt1dWx16pV.cmhRXSHUqCkDXVmCGpZI5rXD6fR2QoCoQNOOf6e3rGqaz1cF_kY4BgKfKWVa_RF.peOg
PIaUYF1L9CFtG2Zj1HkyhgzTcYbJZemoxO3WtOD8PHM3cUGJWvGcAibfDf1Ntu6BmsQa_aZfjZ11ou8n
F1kjeFsf9wUpHOvGS_qOtaUT8b5rV8CXd.mcZyLghscWIOy339QjgZ6nz2PVchf2P2Rd0JhbNR_OzHWb
5l9LBBOH9RM5TkHm7N2HSdxaSxSFA6rLU5gguZU7xFEnQ44o7hMCbyfL4SL6VdOz9hIuTjYh8GHHYTM0
iIU.O.Gh_tNPjLVZ8j6T2G2W1L5JgCYz8K_D7bn8EHL9FNwffqZQgmtXqjqpIFATcQ.h.91zP_uc4mij
gzvwnfE8n80N7hZKVA-%26oauth_version%3D1.0

响应:

<?xml version='1.0' encoding='UTF-8'?>
<yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
xml:lang='en-US'>
<yahoo:description>Please provide valid credentials. OAuth oauth_problem="toke
n_rejected", realm="yahooapis.com"</yahoo:description>
</yahoo:error>

我非常确定此访问令牌未过期。

如何解决这个问题? 谢谢。

I have developed a OAuth Component, and completed Yahoo's OAuth Process, got oauth_token.

But when I make API call to yahoo API (like contact or YQL), I always get "Token_Rejected" error message.

HTTP 401

Signature: 6fR3VdygGrRCO+WrS6tlD3hjHMI=

base_string:

GET&http%3A%2F%2Fsocial.yahooapis.com%2Fv1%2Fuser%2FMOMJS2M2KSMQKT2D
Q4O7NS4JFU%2Fprofile%2Fusercard&oauth_consumer_key%3Ddj0yJmk9ZmZzUFVQblZzM1JVJmQ
9WVdrOU9GbFNRMUJuTmpRbWNHbzlOVFUyTWpRNU9EWXkmcz1jb25zdW1lcnNlY3JldCZ4PTJk%26oaut
h_nonce%3D2366072fe9829333b98eb6f2a7539afa%26oauth_signature_method%3DHMAC-SHA1%
26oauth_timestamp%3D1305099596%26oauth_token%3DA%3D4cnEo.njj1_C6XtkvR3o5x3vOYqrN
hHk3sBFh76pPtcKA07WF69OADx8zU7o0dPSRauN77UIBw.5bEk5opw15A8SSemxquErvhhHPuAhtm0SB
UuGBOSMxapwBdU1.E4oeQQMXIvKRFhy81EVbIDclBcxzeG.y.eEUdNFDkp_suVAKko.i6Tazpbfkqa1C
__7BAQO5m74CIsalgwyyI8z99eITPlzq_llb7CZzhoWJTVzVAVH_hoU2jBbjSwP00AGB.ovXqT0Ayf0.
WHG2v7hhFhVh.MEx6H0oa8rgpUSZr68dViiIPLfV6G.fGCF3GSnE4uVNiDWM2.x4Lf37slpGWqmjUTtX
B8UVlTQU0auc_YCbGC9wSiUHePWEhpzkgQ6lf.G0mZ9VJ5I_9jbZzlJD52ffUoMDVs97qEeT4CRRa.0p
hwt1dWx16pV.cmhRXSHUqCkDXVmCGpZI5rXD6fR2QoCoQNOOf6e3rGqaz1cF_kY4BgKfKWVa_RF.peOg
PIaUYF1L9CFtG2Zj1HkyhgzTcYbJZemoxO3WtOD8PHM3cUGJWvGcAibfDf1Ntu6BmsQa_aZfjZ11ou8n
F1kjeFsf9wUpHOvGS_qOtaUT8b5rV8CXd.mcZyLghscWIOy339QjgZ6nz2PVchf2P2Rd0JhbNR_OzHWb
5l9LBBOH9RM5TkHm7N2HSdxaSxSFA6rLU5gguZU7xFEnQ44o7hMCbyfL4SL6VdOz9hIuTjYh8GHHYTM0
iIU.O.Gh_tNPjLVZ8j6T2G2W1L5JgCYz8K_D7bn8EHL9FNwffqZQgmtXqjqpIFATcQ.h.91zP_uc4mij
gzvwnfE8n80N7hZKVA-%26oauth_version%3D1.0

Response:

<?xml version='1.0' encoding='UTF-8'?>
<yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
xml:lang='en-US'>
<yahoo:description>Please provide valid credentials. OAuth oauth_problem="toke
n_rejected", realm="yahooapis.com"</yahoo:description>
</yahoo:error>

I am very sure this access token is not expired.

How to resolve this problem?
Thanks.

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

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

发布评论

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

评论(3

时光倒影 2024-11-13 13:11:50

我已经解决了这个问题,原因是我错过了查询字符串,当我将查询字符串编码为基本字符串时,这个问题已经解决了。

I had resolved this question, the reason is I missed query string, when I encoded query string into base string, this issue had been solved.

书信已泛黄 2024-11-13 13:11:50

对于将来遇到此问题的任何人:如果您不断从 https 收到“令牌被拒绝”: //api.login.yahoo.com/oauth/v2/get_token 使用 PHP。然后,如果与您的流程相关,请确保您在进行此调用之前对访问令牌调用 urldecode。

For anyone coming across this question in the future: If you keep getting "token rejected" from https://api.login.yahoo.com/oauth/v2/get_token using PHP. Then make sure, if relevant to your flow, that you are calling urldecode on the access token prior to making this call.

清音悠歌 2024-11-13 13:11:50

如果您将访问令牌存储在表中,然后使用该表中的访问令牌调用 API,并且将该列设置为字符串,则该令牌将缩短为 255 个字符。我只是将其从字符串更改为文本并存储它。

当然,如果您将访问令牌存储在表中然后进行调用,则情况如此。当我修复它后,我收到了完全相同的错误消息。

希望我能帮忙,

戈兰

If you're storing the access token in a table, and then calling the API using the access token from that table, it will get shortened to 255 characters if you made the column a string. I just changed it from a string to a text and stored it.

This is of course if you are storing the access token in a table and then making the call. I had this exact same error message, once I fixed that it worked.

Hope I could help,

Goran

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