【问题标题】:LinkedIn API calling in JavascriptJavascript 中的 LinkedIn API 调用
【发布时间】:2023-03-10 12:23:02
【问题描述】:

我在我的 html 页面中使用了 LinkedIn Javascript API 调用。我可以看到“使用 LinkedIn 登录”按钮。在 "onLinkedInLoad" 函数中调用 "IN.Event.on("IN", "auth", onLinkedInAuth);"没有开火。我的代码中有一条警告消息“call2”,它也没有调用。

基本上我想阅读公司更新并绑定到 div。在浏览器控制台中,我得到以下 URL 和配置文件的响应。浏览器控制台中没有其他请求。

https://api.linkedin.com/v1/people::(~):(id,first-name,last-name,headline,picture-url)

在执行此操作以使用公司更新之前,我已按照 LinkedIn 文档中的所有说明进行操作。

  1. 我有一个公司页面并且有更新。
  2. 我创建了一个应用程序,并且只在 js 函数调用中使用该 api 密钥。
  3. 在 LinkedIn REST 控制台中,我可以看到我的更新。

我想念什么吗?谢谢。

我最后使用实际的 api 密钥和公司 ID。

查看我的代码:

<html>
<head>
<title>
    LinkedIn
</title>

<script type="text/javascript" src="https://platform.linkedin.com/in.js">
    api_key: 0000000000000
    onLoad: onLinkedInLoad
    authorize: true
</script>


<script type="text/javascript">
    function onLinkedInLoad() {
        alert('call');
        IN.Event.on("IN", "auth", onLinkedInAuth);
    }


    function onLinkedInAuth() {
        alert('call2');
        IN.API.Raw("/companies/000000/updates")
        .method("GET")
        .result(function(res) {
           document.write(JSON.stringify(res));});
        }

</script>
</head>
<body>
  <script type="IN/Login">
  </script>
</body>
</html>

【问题讨论】:

    标签: linkedin-api linkedin-jsapi


    【解决方案1】:

    我已使用 IN.User.authorize(onLinkedInAuth) 而不是 IN.Event.on("IN", "auth", onLinkedInAuth) 进行授权并工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多