如何在Ionic 3中实现LinkedIn登录?为什么LinkedIn登录无法正常工作?

4

I am using this tutorial.

My code is:

linkedInSignup() {
console.log("linked in login....");

// check if there is an active session
this.linkedin.hasActiveSession().then((active) => {
  console.log('has active session?', active);
  if(active === false) {
    // login
    let scopes:any = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
    this.linkedin.login(scopes, true)
      .then(() => console.log('Logged in!'))
      .catch(e => console.log('Error logging in', e));


    // get connections
    this.linkedin.getRequest('people/~')
      .then(res => console.log(res))
      .catch(e => console.log(e));

    // share something on profile
    const body = {
      comment: 'Hello world!',
      visibility: {
        code: 'anyone'
      }
    };

    this.linkedin.postRequest('~/shares', body)
      .then(res => console.log(res))
      .catch(e => console.log(e));
  }
});

}

已安装插件:

$ ionic cordova plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID
$ npm install --save @ionic-native/linkedin

没有出现任何错误,但是甚至无法使用领英登录。

您能帮助我解决这个问题吗?谢谢。


我们需要一些输出来帮忙。你有添加APP_ID= <- Something,而非YOUR_APP_ID吗?你在LinkedIn中给应用程序授权了吗? - Steven Scott
你得到答案了吗? - Jaydip Kalkani
1个回答

1
我试图在我的应用程序中实现LinkedIn登录,也遇到了同样的问题。 登录功能从未通过成功回调函数。
在进行一些搜索后,我发现了这个 - https://github.com/zyra/cordova-plugin-linkedin#deprecation-notice 看起来LinkedIn已经停止支持移动SDK,并要求所有开发人员转向OAuth 2.0
参考资料 - https://engineering.linkedin.com/blog/2018/12/developer-program-updates 编辑:
所以我用来允许用户使用LinkedIn注册的解决方法是,由于我在服务器端使用Node.js,我使用了passport.js和LinkedIn oAuth,在ionic应用程序中,我利用Ionic InApp Browser显示用户LinkedIn注册页面,并通过LinkedIn从应用程序中注册用户。

这是我目前尝试的解决方案,但如果可能的话,希望使用任何Cordova插件寻找更好的选项。如果我找到了任何东西,我会再次更新答案。


我遇到了同样的问题,你解决了吗?我打算卸载 cordova-plugin-linkedin 因为它已经过时了。但是我应该使用什么替代品呢?谢谢。 - pietà
我找不到任何 Cordova 插件来使这个工作,所以我尝试了一些其他的解决方法来达到我的目的。我会更新我的答案并分享 @pietà。 - Akash Rajpurohit
你是如何在inAppBrowser中处理redirect_uri的?请提供建议。 - Siddharth

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接