如何使用Yahoo IM消息api? (unable_to_determine_oauth_type)

时间:2015-04-13 05:53:04

标签: oauth messaging yahoo

最近,我刚刚通过在线[yahoo oauth 2.0指南为开发人员创建了一个雅虎应用程序,] [2]

我可以获取OAuth 2.0凭据,但在调用yahoo IM相关[API] [3]时遇到“unable_to_determine_oauth_type”oauth问题。为什么?

这是我的步骤:

  1. curl -v https://api.login.yahoo.com/oauth2/request_auth -d 'client_id=[CLIENT-ID]&redirect_uri=oob&response_type=code&language=en-us'

  2. 然后将我重定向到https//login.yahoo.com/oa?.src=oauth2&.partner=&.pd=c%3DmZmAFpe.2e7WuWzcHD2ZPYQ-%26ockey%3Ddj0yJmk9Q1N4cldYYXdKYXhNJmQ9WVdrOWIyOXdXbG95TnpnbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yOQ--&.intl=us&.lang=en-us&.done=https%3A%2F%2Fapi.login.yahoo.com%2Foauth2%2Frequest_auth%3F%26client_id%3Dd[CLIENT-ID]%26redirect_uri%3Doob%26response_type%3Dcode%26language%3Den-us%26crumb%3D

  3. 通过在浏览器中关注它,我得到了代码:dpr5bnm

  4. 我将客户端ID和密码连接成一个用':'分隔的字符串,然后转到base64编码(https://www.base64encode.org

  5. 获取基本凭据:ZGoweUptazlRMU40Y2xkWVlYZEtZWG...ldOSGJ6bE5RUzB0Sm5NOVkyOXVjM1Z0WlhKelpXTnlaWFFtZUQweU9RLS06YjY3MmZlZDcwOGFhYmRjNDFiNGRmYmNlZmY3MzU1YmU2MmRhMWRkZQ==

  6. 然后,调用get_token API

  7. curl https//api.login.yahoo.com/oauth2/get_token -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic ZGoweUptazlRMU40Y2xkWVlYZEtZ...YldOSGJ6bE5RUzB0Sm5NOVkyOXVjM1Z0WlhKelpXTnlaWFFtZUQweU9RLS06YjY3MmZlZDcwOGFhYmRjNDFiNGRmYmNlZmY3MzU1YmU2MmRhMWRkZQ==" -d "grant_type=authorization_code&redirect_uri=oob&code=dpr5bnm"

  8. 获取json访问令牌响应:{“access_token”:“fiTeDQrBnQVB ... u5DGLu.M - ”,“token_type”:“bearer”,“expires_in”:3600,“refresh_token”:“AFaPK .. .xDSwSZ.Ke4jffDDboSpO6fg2t”, “xoauth_yahoo_guid”: “ZT3Y7L7 ... 5QJ7SAU5Q”}

  9. 但是当我使用愿意使用会话管理API登记的令牌时:(OAuth 2.0 Bearer Authorization)

  10. `curl -v http // developer.messenger.yahooapis.com / v1 / session -H“Content-type:application / json; charset = utf-8”-H“授权:Bearer B_YnLlibghNNJIW0HlaITp0mkcTF​​EovpF .. .oJZuzUvjVDM0ko.QjT4io - “

  11. 它显示以下错误:<yahoo:description>Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type"</yahoo:description>

  12. 所以有人知道为什么以及如何制作雅虎IM消息吗?

0 个答案:

没有答案