javascript SDK 突然停止工作,没有显示任何错误#linkedin

javascript SDK suddenly stopped working without showing any error #linkedin

我已经创建了一个应用程序来实现登录链接功能。之前还好好的,突然就不行了

以前,如果用户已经登录到 LinkedIn,单击 login-in-with-linkedIn 按钮将引导用户到相应的仪表板,否则登录弹出窗口打开,用户详细信息保存在数据库中,用户重定向到相应的仪表板仪表板,但现在没有任何反应。

注意:- 我已经使用自定义按钮来使用此功能。不是链接提供的按钮代码。

这是我的代码和应用创建步骤:-

按钮代码:-

<a href="javascript:void(0);" onclick="doLinkedInLoginForBuyer()" class="btn btn--social-li"><?php echo Labels::getLabel('LBL_Linkedin',$siteLangId);?></a>

Javascript sdk代码:-

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key:*********
   authorize:true
</script>
<script>
    function doLinkedInLoginForBuyer(){
       IN.User.authorize(function(){
           onLinkedInAuth();
       });
    }
    function onLinkedInAuth() {
        IN.API.Profile("me").fields("email-address","first-name","id").result(function (data) {
            processLinkedInUserDetails(data);
        }).error(function (data) {
            $.systemMessage('There was some problem in authenticating your account with LinkedIn,Please try with different login option','alert alert--danger'); 
        });
    }
    processLinkedInUserDetails = function(data){
        data = data.values[0];
        fcom.ajax(fcom.makeUrl('LinkedIn', 'loginLinkedIn'), data, function(t) {
            var response = JSON.parse(t);
            if(response.status ==0){
                $.systemMessage(response.msg,'alert alert--danger');  
            }
            if(response.status ==1){
                location.href = response.msg;
            }
        });
    };
</script>

注:-好像根本没有调用onLinkedInAuth()以及processLinkedInUserDetails()函数现在。以前他们工作得很好。

如果需要任何其他详细信息,请告诉我。谢谢!

1.After 与 LinkedIn 客户支持进行了长时间的讨论,他们只是说他们不支持 API 相关问题。他们要求购买高级帐户以获得任何技术支持

2.Also 我知道他们不再支持 Javascript SDK

在这里查看:- JavaScript SDK is not currently supported

解决方案:-现在我按照下面的post让它工作:

https://www.codexworld.com/login-with-linkedin-using-php/

  1. 访问 LinkedIn Developers page 并使用您的 LinkedIn 帐户凭据登录。

  2. 单击“创建应用”按钮创建一个新的 LinkedIn 应用。

  3. 提供有关您的应用程序的信息,然后单击创建应用程序以提交应用程序注册表。

    App name – Name of the application.
    Company – Name of your company.
    App description – Workflow of the application.
    App logo – Logo to display on the OAuth dialog.
    Privacy policy URL – URL of the Privacy Policy page.
    Business email – Your email address.
    Products – Select the products that you’d like to add to your app.
    
  4. 成功创建应用程序后,页面将重定向到应用程序设置屏幕。

  5. 切换到“身份验证”选项卡 » 向下滚动到“OAuth 2.0 设置”部分。

    在重定向 URL 字段中指定重定向 URL 并更新应用程序设置。

    注意:重定向 URL 必须与脚本中指定的重定向 URL 匹配。

  6. 在“应用程序凭据”部分,您将看到 LinkedIn 应用程序的客户端 ID 和客户端密码。 App ID 和 App secret 需要在调用 LinkedIn API 时在脚本中指定。

现在您必须创建 php 代码,该代码将在客户端 ID 和客户端密码的帮助下调用链接 API。

请检查Php code of thread for example.