【问题标题】:Duplicate grant_type parameter Uber API重复的grant_type参数Uber API
【发布时间】:2017-10-28 11:14:04
【问题描述】:

我正在尝试使用 Cortana 的 Connected 帐户获得对 Uber 的 OAuth 访问权限。

所有必需的身份验证数据,即身份验证 URL、令牌 URL、客户端密码等都取自 Uber API 描述并传递给 Cortana,因此她必须为我完成所有低级工作。

但是当我尝试登录优步时,我收到了这样的答案:

"error": "The token response status code was not 200.",
"serviceRequest": {
    "Host": "login.uber.com",
    "Headers": {
        "Content-Type": "application/x-www-form-urlencoded",
        "Authorization": "Basic VXF6cGVzeWVwYXFPZDBrc0FsUTh3U0dTHFvb2k6TFg0TWFhVDRwU0NFNlM3ZDJVMGJSdlU0VnJhTnRncFJPVlo4UkNqQg=="
    },
    "Method": "POST",
    "Path": "/oauth/v2/token",
    "UrlParameters": {
        "redirect_uri": "https://www.bing.com/agents/oauth",
        "grant_type": "authorization_code",
        "code": "some code private here :)"
    },
    "PostData": "redirect_uri=https%3a%2f%2fwww.bing.com%2fagents%2foauth&grant_type=authorization_code&code=SOME_AUTHORIZATION_CODE"
},
"serviceResponse": {
    "Headers": {
        "Connection": "keep-alive",
        "Pragma": "no-cache",
        "X-Uber-App": "login",
        "Strict-Transport-Security": "max-age=604800",
        "X-Content-Type-Options": "nosniff",
        "X-XSS-Protection": "1; mode=block",
        "Cache-Control": "no-store",
        "Date": "Sat, 28 Oct 2017 10:30:57 GMT",
        "Set-Cookie": "session=421370309da06baf_59f45c61.RKb0a7144yyiV9HlZgssA5ZvSqE; Domain=login.uber.com; Secure; HttpOnly; Path=/",
        "Server": "nginx",
        "Content-Length": "84",
        "Content-Type": "application/json"
    },
    "StatusCode": 400,
    "ResponseData": "{\"error_description\": \"Duplicate grant_type parameter.\", \"error\": \"invalid_request\"}"
},

如您所见,在属性ResponseData 我有一个错误:Duplicate grant_type parameter.

会是什么?

【问题讨论】:

    标签: oauth-2.0 uber-api cortana cortana-skills-kit


    【解决方案1】:

    当令牌请求包含在 POST 数据中时,您是否需要将令牌请求的 auth 参数作为 URL 参数重复。我假设“这里有一些私有代码:)”和 SOME_AUTHORIZATION_CODE 是相同的。

    【讨论】:

    • 是的,没错,这是相同的代码。但不是我重复他们。 Cortana 提出的请求,据我所知,我无法影响其内容。所以,总的来说,Cortana 的工作原理是这样的——这个服务在请求中复制了参数。
    猜你喜欢
    • 2012-06-27
    • 2014-10-14
    • 1970-01-01
    • 2016-10-02
    • 2019-09-14
    • 1970-01-01
    • 2020-12-04
    • 2019-07-16
    • 2012-01-02
    相关资源
    最近更新 更多