我正在尝试将“通过 LinkedIn 申请”按钮添加到表达式引擎网站。我已经在 LinkedIn 上创建了我的应用程序,并且正在使用 JS SDK,并按照指南进行操作。我的代码如下:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: MY CLIENT ID
authorize: true
onLoad: onLinkedInLoad
</script>
<script type="text/javascript">
// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
IN.Event.on(IN, "auth", getProfileData);
}
// Handle the successful return from the API call
function onSuccess(data) {
console.log(data);
}
// Handle an error response from the API call
function onError(error) {
console.log(error);
}
// Use the API call wrapper to request the member's profile data
function getProfileData() {
IN.API.Raw("/people/~:(id, first-name, skills, educations, languages, twitter-accounts)")
.result(onSuccess).error(onError);
}
</script>
我已按照建议添加了按钮标记:
<script type="in/Login"></script>
因此显示按钮,单击时会显示我的帐户以授权应用程序,但是,在进行身份验证时,按钮消失并且我收到以下错误:
Failed to load resource: the server responded with a status of 400 (Bad Request)
ObjecterrorCode: 0message: "Unknown field {_first-name} in resource {Person}"requestId: "LT59BVDVU2"status: 400timestamp: 1436259208629__proto__: Object
谢谢!