Python 3.x 客户端id在Linkedin令牌回顾的POST请求期间丢失错误
我想通过使用Linkedin中的令牌内省端点来获取令牌的元数据Python 3.x 客户端id在Linkedin令牌回顾的POST请求期间丢失错误,python-3.x,api,token,linkedin-api,Python 3.x,Api,Token,Linkedin Api,我想通过使用Linkedin中的令牌内省端点来获取令牌的元数据 import requests headers = {"Content-Type": "application/x-www-form-urlencoded"} client_id=1234 client_secret=4567 token= 435kwer url = 'https://www.linkedin.com/oauth/v2/introspectToken?client_id={}
import requests
headers = {"Content-Type": "application/x-www-form-urlencoded"}
client_id=1234
client_secret=4567
token= 435kwer
url = 'https://www.linkedin.com/oauth/v2/introspectToken?client_id={}&client_secret={}&token={}'.format(client_id,client_secret,token)
response = requests.post(url,headers=headers).json()
print(response)
我得到以下错误
{
'error': 'invalid_request',
'error_description': 'A required parameter "client_id" is missing'
}
我不知道为什么我会犯这个错误
我使用以下URL作为参考
如果您从URL查看示例
curl --location --request POST 'https://www.linkedin.com/oauth/v2/introspectToken' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<Application Client ID>' \
--data-urlencode 'client_secret=<Application Client Secret>' \
--data-urlencode 'token=<Token Value>'
curl--位置--请求发布'https://www.linkedin.com/oauth/v2/introspectToken' \
--标题“内容类型:应用程序/x-www-form-urlencoded”\
--数据urlencode“客户端\u id=”\
--数据urlencode“客户端\u密码=”\
--数据urlencode'token='
参数也应该被编码。因此,如果您将客户机id、客户机secret和令牌放入cURL中,您将获得良好的响应