为什么 yahoo oauth2 获取 token api 总是返回“code cant be null”?

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

enter image description here

enter image description here

我按照文档传递参数,但是总是返回“对于authorization_code grant type,code参数不能为空”

除了使用urlencode形式外,还使用请求体,但返回“客户端请求不可接受或不支持”

我确定 client_id 和 client_secret 是正确的

enter image description here

application/x-www-form-urlencoded(

Authorization
已脱敏)

curl --location --request POST 'https://api.login.yahoo.com/oauth2/get_token?code=b9r5j5rbw6vug953442kj9qdnretnrrf' \
--header 'Authorization: Basic ZGoweUptazlXVkpxUTBkS1JIZEdPWHB5Sm1ROVdWZHJPVTlYTVVSUk1uUnVWbTF6YldOSGJ6bE5RVDA5Sm5NOVkyOXVjM1Z0' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Accept: */*' \
--header 'Host: api.login.yahoo.com' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'code=b9r5j5rbw6vug953442kj9qdnretnrrf' \
--data-urlencode 'redirect_uri=https://s.theckb.com/auth' \
--data-urlencode 'grant_type=authorization_code'

application/json(

client_secret
已脱敏)

curl --location --request POST 'https://api.login.yahoo.com/oauth2/get_token?code=b9r5j5rbw6vug953442kj9qdnretnrrf' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Host: api.login.yahoo.com' \
--header 'Connection: keep-alive' \
--data-raw '{
    "client_id": "dj0yJmk9WVJqQ0dKRHdGOXpyJmQ9WVdrOU9XMURRMnRuVm1zbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTg0",
    "client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "redirect_uri": "https://s.theckb.com/auth",
    "code": "b9r5j5rbw6vug953442kj9qdnretnrrf",
    "grant_type": "authorization_code"
}'
api oauth-2.0 oauth yahoo-api yahoo-oauth
1个回答
0
投票

application/x-www-form-urlencoded
模式下,删除url上的代码。

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