我正在尝试在Expressionengine网站上添加“按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
谢谢!
答案 0 :(得分:0)
使用camelcasing而不是破折号: IN.API.Raw(&#34; / people /~ :( id,firstName,skills,educations,languages,twitter-accounts)&#34;)