[英]how to make request to LinkedIn API v2 and OAuth 2.0 without JS SDK?
我正在嘗試直接從瀏覽器集成LinkedIn v2 OAuth 2.0登錄,但是為了解決Ovid跨域問題,我需要使用JS SDK。
但我在這里看到: https : //engineering.linkedin.com/blog/2018/12/developer-program-updates
從3月1日開始的js SDK無法正常工作
SDK:我們的JavaScript和移動軟件開發套件(SDK)將停止運行。 開發人員將需要直接從其應用遷移到使用OAuth 2.0。
因此,如果沒有SDK,該如何使用LinkedIn進行登錄? (而且我不能使用任何非免費或非商業性的OAuth庫)
並且還試圖避免為此使用服務器端
這是V1 API的解決方案。 我不確定在API的V2中是否會繼續。
您可以使用以下參數創建URL,但是image
和summary
字段按預期顯示時會出現一些問題。
page
- page
網址 title
-頁面內容 summary
-內容摘要 source
-網站名稱 這樣構造URL :(內插字符串示例)
https://www.linkedin.com/shareArticle?mini=true&url=${page}&title=${title}&summary=${summary}&source=${source}
如果您控制html元標記,則建議將以下內容應用到共享中,以獲取更豐富的體驗。
<meta property="og:title" content="My Shared Article Title" />
<meta property="og:description" content="Description of shared article" />
<meta property="og:url" content="http://example.com/my_article.html" />
<meta property="og:image" content="http://example.com/foo.jpg" />
本示例使用共享鏈接創建一個新窗口。
let page = this.getPageUrl(true);
let title = this.getTagTitle(true);
let summary = this.getTagDescription(true);
let source = this.getTitle(true);
let tokenLink = `https://www.linkedin.com/shareArticle?mini=true&url=${page}&title=${title}&summary=${summary}&source=${source}`;
window.open(tokenLink);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.