【问题标题】:Getting error while fetching uber authentication token获取超级身份验证令牌时出错
【发布时间】:2016-06-04 08:34:27
【问题描述】:

从 uber 获取身份验证令牌是一个两步过程。 请参考Uber Auth API

  1. 请求超级用户授权:调用GET https://login.uber.com/oauth/v2/authorize?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}

提供特定于您网站的 client_id 和 redirect_uri。如果授权成功,您将使用查询参数中的代码重定向到您的站点。

  1. 您在步骤 1 中获取的用于检索身份验证令牌的代码。 向https://login.uber.com/oauth/v2/token 发送 HTTP POST 请求。以下应该是您发送到服务器的 json:

    { "client_secret": "{client_secret}", "client_id": "{client_id}", "grant_type": "{authorization_code}", "redirect_uri": "{redirect_uri}", "code": "{插入上一步获取的授权码}" }

在第二步中,我总是收到带有“无效授权类型”消息的错误 400。请建议我哪里出错了。

【问题讨论】:

    标签: authentication oauth uber-api


    【解决方案1】:

    您需要将参数作为表单数据发送,而不是 JSON。在此处查看第 3 节中的 curl 示例:https://developer.uber.com/docs/authentication

    【讨论】:

      【解决方案2】:

      authorization and authentication documentation 没有提及任何关于 JSON 的内容,因此 application/x-www-form-urlencoded media type 用于将 HTTP POST 请求发送到 /oauth/v2/token API 端点

      【讨论】:

      猜你喜欢
      • 2019-05-07
      • 2016-03-16
      • 2015-06-21
      • 2013-12-04
      • 2015-06-01
      • 2019-03-05
      • 1970-01-01
      • 1970-01-01
      • 2015-04-05
      相关资源
      最近更新 更多