LinkedIn共享回调Javascript SDK / API v2 [英] LinkedIn share callback Javascript SDK/API v2
问题描述
我正在尝试通过LinkedIn JavaScript SDK分享内容。但LinkedIn刚刚更新了他们的API,我无法弄清楚如何:在弹出窗口内共享一个URL并在成功共享上获得回调。
I am trying to share content through the LinkedIn JavaScript SDK. But LinkedIn just updated their API and I cannot figure out how to: share a URL inside a popup and get a callback on a successful share.
使用旧的LinkedIn共享插件你有这样的事情:
With the old LinkedIn share plugin you had something like this:
https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/plugins/share-plugin
<script src="//platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>
<script type="IN/Share" data-url="https://www.linkedin.com"></script>
但它有一个on-success属性(这不再起作用了。)
But it had an on-success attribute (this doesn't work anymore).
我还想到了一些解决方法,比如检查共享计数器是否有+1。但该计数器也被弃用了。另一种解决方法可能是检查共享弹出窗口何时关闭。但是用户可以关闭它,并且他们共享'成功'。
I also thought of some work around like checking if there is a +1 to the share counter. But the counter is also deprecated. Another workaround could be checking when the share popup closes. But then the user can just close it, and they shared 'successfully'.
推荐答案
您使用与LinkedIn共享功能(支持成功回调) JavaScript SDK 将根据链接的 developer-program-updates 。
You were sharing content using Share with LinkedIn feature (which supported the on-success callback) of JavaScript SDK which is going to be deprecated according to linked-in's developer-program-updates.
我们的JavaScript和移动软件开发套件(SDK)将停止运行。开发人员需要直接从他们的应用程序迁移到使用OAuth 2.0。
Our JavaScript and Mobile Software Development Kits (SDKs) will stop working. Developers will need to migrate to using OAuth 2.0 directly from their apps.
此处它指示开发人员迁移到 OAuth 2.0 但你正在研究共享插件它仅提供基本的URL共享功能。
如果您查看文档,可以看到响应部分包含成功的 201 Created
状态代码,还包括新创建的帖子的ID。
Here it instructs developers to migrate to OAuth 2.0 but you are looking into the share plugin which provides only basic URL sharing functionality only.
If you look into the docs you can see the response section contains 201 Created
status code on success and also includes ID of the newly created post.
这篇关于LinkedIn共享回调Javascript SDK / API v2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!