有人做过雅虎的 oauth2 登录吗?

查看 18|回复 0
作者:j1132888093   
获取 AccessToken 时,官网有两种方式,x-www-form-urlencode 和 json 的形式,我直接调接口都跑不通...
x-www-form-urlencoded (Authorization和redirect_url做了脱敏处理)
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://test.com/auth' \
--data-urlencode 'grant_type=authorization_code'
返回
{
    "error": "INVALID_INPUT",
    "error_description": "code parameter cannot be empty for authorization_code grant type"
}
json (client_secret和redirect_url做了脱敏处理)
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": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
    "redirect_uri": "https://test.com/auth",
    "code": "b9r5j5rbw6vug953442kj9qdnretnrrf",
    "grant_type": "authorization_code"
}'
返回
{
    "error": {
        "localizedMessage": "client request is not acceptable or not supported",
        "errorId": "INVALID_INPUT",
        "message": "client request is not acceptable or not supported"
    }
}
client_id和client_secret确定是对的,大佬们帮忙看看
您需要登录后才可以回帖 登录 | 立即注册

返回顶部