oauth V2 令牌给出无效范围

问题描述 投票:0回答:1

API 卷曲:

curl --location 'https://login.uber.com/oauth/v2/token' \
\--header 'Content-Type: application/x-www-form-urlencoded' \
\--data-urlencode 'client_secret=SECRET_FROM_APPLICATIONS_DASHBOARD' \
\--data-urlencode 'client_id=CLIENTID_FROM_APPLICATIONS_DASHBOARD' \
\--data-urlencode 'grant_type=client_credentials' \
\--data-urlencode 'scopes=guests.trips'

文档链接:https://developer.uber.com/docs/guest-rides/guides/authentication

我期待它给予:

{
    "access_token": "{TokenValue}",
    "token_type": "Bearer",
    "expires_in": 2592000,
    "scope": "guests.trips"
}

但我将其作为邮递员的输出:

{
    "error": "invalid_scope",
    "error_description": "scope(s) are invalid"
}

除了上面提到的之外,我没有进行任何其他 API 调用。在调用此端点之前我需要执行任何操作吗?如果不需要,那么为什么会出现无效范围作为输出。

rest uber-api
1个回答
0
投票

范围请求参数似乎有语法错误。 应该是“范围”而不是“范围”。 这也是您收到 error_code 'invalid_scope' 的原因,可能是因为它在 OAuth 规范 中是未知的。

你可以看看uber自己的API文档, 他们也有一个很好的 client_credentials 示例。

© www.soinside.com 2019 - 2024. All rights reserved.