我使用Oauth2获取访问令牌,我可以获取代码,但是当我使用邮递员获取访问令牌时,我的状态为403。
这是我正在使用的网址:
https://www.linkedin.com/oauth/V2/accesstoken?grant_type=authorization_code&code=AQSSeTJlPER2UXROrlcxnZu1233VFqSGpnbb3LbySelnmayljjpasMtsCGJkPOD-tXGl4U_P-7q-OUxZl9cIvwo1niVT4v9UxfkBk-i0b4ZhY_2rKugw-ZXCPbQrf9qlfj9TX2eraJzfykUT78I7M6HRB0NMz5iqlnOmPvE5Yf6S486OTomn5xI-E2fk-FA&client_id=86k52xk4123dza&client_secret=kaouvpg1212iJyrw&redirect_uri=https%3A%2F%2F/www.test.co%2
响应:
<html lang="en">
<head>
<title>Unauthorized</title>
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAlFJREFUeNqUU8tOFEEUPVVdNV3dPe8xYRBnjGhmBgKjKzCIiQvBoIaNbly5Z+PSv3Aj7DSiP2B0rwkLGVdGgxITSCRIJGSMEQWZR3eVt5sEFBgTb/dN1yvnnHtPNTPG4PqdHgCMXnPRSZrpSuH8vUJu4DE4rYHDGAZDX62BZttHqTiIayM3gGiXQsgYLEvATaqxU+dy1U13YXapXptpNHY8iwn8KyIAzm1KBdtRZWErpI5lEWTXp5Z/vHpZ3/wyKKwYGGOdAYwR0EZwoezTYApBEIObyELl/aE1/83cp40Pt5mxqCKrE4Ck+mVWKKcI5tA8BLEhRBKJLjez6a7MLq7XZtp+yyOawwCBtkiBVZDKzRk4NN7NQBMYPHiZDFhXY+p9ff7F961vVcnl4R5I2ykJ5XFN7Ab7Gc61VoipNBKF+PDyztu5lfrSLT/wIwCxq0CAGtXHZTzqR2jtwQiXONma6hHpj9sLT7YaPxfTXuZdBGA02Wi7FS48YiTfj+i2NhqtdhP5RC8mh2/Op7y0v6eAcWVLFT8D7kWX5S9mepp+C450MV6aWL1cGnvkxbwHtLW2B9AOkLeUd9KEDuh9fl/7CEj7YH5g+3r/lWfF9In7tPz6T4IIwBJOr1SJyIGQMZQbsh5P9uBq5VJtqHh2mo49pdw5WFoEwKWqWHacaWOjQXWGcifKo6vj5RGS6zykI587XeUIQDqJSmAp+lE4qt19W5P9o8+Lma5DcjsC8JiT607lMVkdqQ0Vyh3lHhmh52tfNy78ajXv0rgYzv8nfwswANuk+7sD/Q0aAAAAAElFTkSuQmCC">
<style>
html, body, pre {
margin: 0;
padding: 0;
font-family: Monaco, 'Lucida Console', monospace;
background: #ECECEC;
}
h1 {
margin: 0;
background: #333;
padding: 20px 45px;
color: #fff;
text-shadow: 1px 1px 1px rgba(0,0,0,.3);
border-bottom: 1px solid #111;
font-size: 28px;
}
答案 0 :(得分:0)
您似乎正在执行GET请求,导致根据此处的第3步将参数作为查询字符串参数发送:https://developer.linkedin.com/docs/oauth2
他们希望您发出POST请求,这将导致通过表单参数发送参数。
如果您使用的是邮递员,请单击URL旁边的GET图标,然后将其更改为POST。
==== EDIT =====
您应该从代码示例中删除client_id和client_secret。这是非常不安全的,并且可能允许某人使用您的帐户向LinkedIn发送请求。